diff options
author | tsepez <tsepez@chromium.org> | 2016-03-25 15:18:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 15:18:36 -0700 |
commit | b5e8f14e3eefc5da995b332788d3203cee204883 (patch) | |
tree | 34fc80504d2034013b18f30df1b0f6f1a94e2d70 | |
parent | 6d18bd3b8ec82ae3c24a439f5c7925786a0e2d8b (diff) | |
download | pdfium-b5e8f14e3eefc5da995b332788d3203cee204883.tar.xz |
Remove FX_DWORD from core/ and delete definitionchromium/2695chromium/2694chromium/2693chromium/2692
Review URL: https://codereview.chromium.org/1832173003
233 files changed, 3034 insertions, 3036 deletions
diff --git a/core/fdrm/crypto/fx_crypt.cpp b/core/fdrm/crypto/fx_crypt.cpp index d5cbdb5a82..f3665060f8 100644 --- a/core/fdrm/crypto/fx_crypt.cpp +++ b/core/fdrm/crypto/fx_crypt.cpp @@ -12,7 +12,7 @@ extern "C" { struct rc4_state { int x, y, m[256]; }; -void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length) { +void CRYPT_ArcFourSetup(void* context, const uint8_t* key, uint32_t length) { rc4_state* s = (rc4_state*)context; int i, j, k, *m, a; s->x = 0; @@ -32,7 +32,7 @@ void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length) { } } } -void CRYPT_ArcFourCrypt(void* context, unsigned char* data, FX_DWORD length) { +void CRYPT_ArcFourCrypt(void* context, unsigned char* data, uint32_t length) { struct rc4_state* s = (struct rc4_state*)context; int i, x, y, *m, a, b; x = s->x; @@ -50,24 +50,24 @@ void CRYPT_ArcFourCrypt(void* context, unsigned char* data, FX_DWORD length) { s->y = y; } void CRYPT_ArcFourCryptBlock(uint8_t* pData, - FX_DWORD size, + uint32_t size, const uint8_t* key, - FX_DWORD keylen) { + uint32_t keylen) { rc4_state s; CRYPT_ArcFourSetup(&s, key, keylen); CRYPT_ArcFourCrypt(&s, pData, size); } struct md5_context { - FX_DWORD total[2]; - FX_DWORD state[4]; + uint32_t total[2]; + uint32_t state[4]; uint8_t buffer[64]; }; #define GET_FX_DWORD(n, b, i) \ { \ - (n) = (FX_DWORD)((uint8_t*)b)[(i)] | \ - (((FX_DWORD)((uint8_t*)b)[(i) + 1]) << 8) | \ - (((FX_DWORD)((uint8_t*)b)[(i) + 2]) << 16) | \ - (((FX_DWORD)((uint8_t*)b)[(i) + 3]) << 24); \ + (n) = (uint32_t)((uint8_t*)b)[(i)] | \ + (((uint32_t)((uint8_t*)b)[(i) + 1]) << 8) | \ + (((uint32_t)((uint8_t*)b)[(i) + 2]) << 16) | \ + (((uint32_t)((uint8_t*)b)[(i) + 3]) << 24); \ } #define PUT_FX_DWORD(n, b, i) \ { \ @@ -77,7 +77,7 @@ struct md5_context { (((uint8_t*)b)[(i) + 3]) = (uint8_t)(((n) >> 24) & 0xFF); \ } void md5_process(struct md5_context* ctx, const uint8_t data[64]) { - FX_DWORD A, B, C, D, X[16]; + uint32_t A, B, C, D, X[16]; GET_FX_DWORD(X[0], data, 0); GET_FX_DWORD(X[1], data, 4); GET_FX_DWORD(X[2], data, 8); @@ -190,9 +190,9 @@ void CRYPT_MD5Start(void* context) { ctx->state[2] = 0x98BADCFE; ctx->state[3] = 0x10325476; } -void CRYPT_MD5Update(void* pctx, const uint8_t* input, FX_DWORD length) { +void CRYPT_MD5Update(void* pctx, const uint8_t* input, uint32_t length) { struct md5_context* ctx = (struct md5_context*)pctx; - FX_DWORD left, fill; + uint32_t left, fill; if (!length) { return; } @@ -224,7 +224,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}; void CRYPT_MD5Finish(void* pctx, uint8_t digest[16]) { struct md5_context* ctx = (struct md5_context*)pctx; - FX_DWORD last, padn; + uint32_t last, padn; uint8_t msglen[8]; PUT_FX_DWORD(ctx->total[0], msglen, 0); PUT_FX_DWORD(ctx->total[1], msglen, 4); @@ -238,7 +238,7 @@ void CRYPT_MD5Finish(void* pctx, uint8_t digest[16]) { PUT_FX_DWORD(ctx->state[3], digest, 12); } void CRYPT_MD5Generate(const uint8_t* input, - FX_DWORD length, + uint32_t length, uint8_t digest[16]) { md5_context ctx; CRYPT_MD5Start(&ctx); @@ -246,13 +246,13 @@ void CRYPT_MD5Generate(const uint8_t* input, CRYPT_MD5Finish(&ctx, digest); } static FX_BOOL (*g_PubKeyDecryptor)(const uint8_t* pData, - FX_DWORD size, + uint32_t size, uint8_t* data_buf, - FX_DWORD& data_len) = NULL; + uint32_t& data_len) = NULL; void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, - FX_DWORD size, + uint32_t size, uint8_t* data_buf, - FX_DWORD& data_len)) { + uint32_t& data_len)) { g_PubKeyDecryptor = func; } #ifdef __cplusplus diff --git a/core/fdrm/crypto/fx_crypt_aes.cpp b/core/fdrm/crypto/fx_crypt_aes.cpp index b56d8fe33c..1a6eab4283 100644 --- a/core/fdrm/crypto/fx_crypt_aes.cpp +++ b/core/fdrm/crypto/fx_crypt_aes.cpp @@ -804,9 +804,9 @@ static void aes_encrypt_cbc(unsigned char* dest, FXSYS_memcpy(ctx->iv, iv, sizeof(iv)); } void CRYPT_AESSetKey(void* context, - FX_DWORD blocklen, + uint32_t blocklen, const uint8_t* key, - FX_DWORD keylen, + uint32_t keylen, FX_BOOL bEncrypt) { aes_setup((AESContext*)context, blocklen, key, keylen); } @@ -819,13 +819,13 @@ void CRYPT_AESSetIV(void* context, const uint8_t* iv) { void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, - FX_DWORD len) { + uint32_t len) { aes_decrypt_cbc(dest, src, len, (AESContext*)context); } void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, - FX_DWORD len) { + uint32_t len) { aes_encrypt_cbc(dest, src, len, (AESContext*)context); } #ifdef __cplusplus diff --git a/core/fdrm/crypto/fx_crypt_sha.cpp b/core/fdrm/crypto/fx_crypt_sha.cpp index 5f1558943d..28b3ce3739 100644 --- a/core/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/fdrm/crypto/fx_crypt_sha.cpp @@ -84,7 +84,7 @@ void CRYPT_SHA1Start(void* context) { s->blkused = 0; s->lenhi = s->lenlo = 0; } -void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size) { +void CRYPT_SHA1Update(void* context, const uint8_t* data, uint32_t size) { SHA_State* s = (SHA_State*)context; unsigned char* q = (unsigned char*)data; unsigned int wordblock[16]; @@ -147,7 +147,7 @@ void CRYPT_SHA1Finish(void* context, uint8_t digest[20]) { } } void CRYPT_SHA1Generate(const uint8_t* data, - FX_DWORD size, + uint32_t size, uint8_t digest[20]) { SHA_State s; CRYPT_SHA1Start(&s); @@ -155,14 +155,14 @@ void CRYPT_SHA1Generate(const uint8_t* data, CRYPT_SHA1Finish(&s, digest); } typedef struct { - FX_DWORD total[2]; - FX_DWORD state[8]; + uint32_t total[2]; + uint32_t state[8]; uint8_t buffer[64]; } sha256_context; #define GET_FX_DWORD(n, b, i) \ { \ - (n) = ((FX_DWORD)(b)[(i)] << 24) | ((FX_DWORD)(b)[(i) + 1] << 16) | \ - ((FX_DWORD)(b)[(i) + 2] << 8) | ((FX_DWORD)(b)[(i) + 3]); \ + (n) = ((uint32_t)(b)[(i)] << 24) | ((uint32_t)(b)[(i) + 1] << 16) | \ + ((uint32_t)(b)[(i) + 2] << 8) | ((uint32_t)(b)[(i) + 3]); \ } #define PUT_FX_DWORD(n, b, i) \ { \ @@ -185,8 +185,8 @@ void CRYPT_SHA256Start(void* context) { ctx->state[7] = 0x5BE0CD19; } static void sha256_process(sha256_context* ctx, const uint8_t data[64]) { - FX_DWORD temp1, temp2, W[64]; - FX_DWORD A, B, C, D, E, F, G, H; + uint32_t temp1, temp2, W[64]; + uint32_t A, B, C, D, E, F, G, H; GET_FX_DWORD(W[0], data, 0); GET_FX_DWORD(W[1], data, 4); GET_FX_DWORD(W[2], data, 8); @@ -300,9 +300,9 @@ 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, const uint8_t* input, FX_DWORD length) { +void CRYPT_SHA256Update(void* context, const uint8_t* input, uint32_t length) { sha256_context* ctx = (sha256_context*)context; - FX_DWORD left, fill; + uint32_t left, fill; if (!length) { return; } @@ -335,8 +335,8 @@ 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}; void CRYPT_SHA256Finish(void* context, uint8_t digest[32]) { sha256_context* ctx = (sha256_context*)context; - FX_DWORD last, padn; - FX_DWORD high, low; + uint32_t last, padn; + uint32_t high, low; uint8_t msglen[8]; high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); low = (ctx->total[0] << 3); @@ -356,7 +356,7 @@ void CRYPT_SHA256Finish(void* context, uint8_t digest[32]) { PUT_FX_DWORD(ctx->state[7], digest, 28); } void CRYPT_SHA256Generate(const uint8_t* data, - FX_DWORD size, + uint32_t size, uint8_t digest[32]) { sha256_context ctx; CRYPT_SHA256Start(&ctx); @@ -546,13 +546,13 @@ static void sha384_process(sha384_context* ctx, const uint8_t data[128]) { ctx->state[6] += G; ctx->state[7] += H; } -void CRYPT_SHA384Update(void* context, const uint8_t* input, FX_DWORD length) { +void CRYPT_SHA384Update(void* context, const uint8_t* input, uint32_t length) { sha384_context* ctx = (sha384_context*)context; - FX_DWORD left, fill; + uint32_t left, fill; if (!length) { return; } - left = (FX_DWORD)ctx->total[0] & 0x7F; + left = (uint32_t)ctx->total[0] & 0x7F; fill = 128 - left; ctx->total[0] += length; if (ctx->total[0] < length) { @@ -576,7 +576,7 @@ void CRYPT_SHA384Update(void* context, const uint8_t* input, FX_DWORD length) { } void CRYPT_SHA384Finish(void* context, uint8_t digest[48]) { sha384_context* ctx = (sha384_context*)context; - FX_DWORD last, padn; + uint32_t last, padn; uint8_t msglen[16]; FXSYS_memset(msglen, 0, 16); uint64_t high, low; @@ -584,7 +584,7 @@ void CRYPT_SHA384Finish(void* context, uint8_t digest[48]) { low = (ctx->total[0] << 3); PUT_FX_64DWORD(high, msglen, 0); PUT_FX_64DWORD(low, msglen, 8); - last = (FX_DWORD)ctx->total[0] & 0x7F; + last = (uint32_t)ctx->total[0] & 0x7F; padn = (last < 112) ? (112 - last) : (240 - last); CRYPT_SHA384Update(ctx, sha384_padding, padn); CRYPT_SHA384Update(ctx, msglen, 16); @@ -596,7 +596,7 @@ void CRYPT_SHA384Finish(void* context, uint8_t digest[48]) { PUT_FX_64DWORD(ctx->state[5], digest, 40); } void CRYPT_SHA384Generate(const uint8_t* data, - FX_DWORD size, + uint32_t size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA384Start(&context); @@ -618,12 +618,12 @@ void CRYPT_SHA512Start(void* context) { ctx->state[6] = FX_ato64i("1f83d9abfb41bd6b"); ctx->state[7] = FX_ato64i("5be0cd19137e2179"); } -void CRYPT_SHA512Update(void* context, const uint8_t* data, FX_DWORD size) { +void CRYPT_SHA512Update(void* context, const uint8_t* data, uint32_t size) { CRYPT_SHA384Update(context, data, size); } void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) { sha384_context* ctx = (sha384_context*)context; - FX_DWORD last, padn; + uint32_t last, padn; uint8_t msglen[16]; FXSYS_memset(msglen, 0, 16); uint64_t high, low; @@ -631,7 +631,7 @@ void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) { low = (ctx->total[0] << 3); PUT_FX_64DWORD(high, msglen, 0); PUT_FX_64DWORD(low, msglen, 8); - last = (FX_DWORD)ctx->total[0] & 0x7F; + last = (uint32_t)ctx->total[0] & 0x7F; padn = (last < 112) ? (112 - last) : (240 - last); CRYPT_SHA512Update(ctx, sha384_padding, padn); CRYPT_SHA512Update(ctx, msglen, 16); @@ -645,7 +645,7 @@ void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) { PUT_FX_64DWORD(ctx->state[7], digest, 56); } void CRYPT_SHA512Generate(const uint8_t* data, - FX_DWORD size, + uint32_t size, uint8_t digest[64]) { sha384_context context; CRYPT_SHA512Start(&context); diff --git a/core/fdrm/crypto/include/fx_crypt.h b/core/fdrm/crypto/include/fx_crypt.h index 4563b7fa43..155def6f88 100644 --- a/core/fdrm/crypto/include/fx_crypt.h +++ b/core/fdrm/crypto/include/fx_crypt.h @@ -14,55 +14,55 @@ extern "C" { #endif void CRYPT_ArcFourCryptBlock(uint8_t* data, - FX_DWORD size, + uint32_t size, const uint8_t* key, - FX_DWORD keylen); -void CRYPT_ArcFourSetup(void* context, const uint8_t* key, FX_DWORD length); -void CRYPT_ArcFourCrypt(void* context, uint8_t* data, FX_DWORD size); + uint32_t keylen); +void CRYPT_ArcFourSetup(void* context, const uint8_t* key, uint32_t length); +void CRYPT_ArcFourCrypt(void* context, uint8_t* data, uint32_t size); void CRYPT_AESSetKey(void* context, - FX_DWORD blocklen, + uint32_t blocklen, const uint8_t* key, - FX_DWORD keylen, + uint32_t keylen, FX_BOOL bEncrypt); void CRYPT_AESSetIV(void* context, const uint8_t* iv); void CRYPT_AESDecrypt(void* context, uint8_t* dest, const uint8_t* src, - FX_DWORD size); + uint32_t size); void CRYPT_AESEncrypt(void* context, uint8_t* dest, const uint8_t* src, - FX_DWORD size); -void CRYPT_MD5Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[16]); + uint32_t size); +void CRYPT_MD5Generate(const uint8_t* data, uint32_t size, uint8_t digest[16]); void CRYPT_MD5Start(void* context); -void CRYPT_MD5Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_MD5Update(void* context, const uint8_t* data, uint32_t size); void CRYPT_MD5Finish(void* context, uint8_t digest[16]); -void CRYPT_SHA1Generate(const uint8_t* data, FX_DWORD size, uint8_t digest[20]); +void CRYPT_SHA1Generate(const uint8_t* data, uint32_t size, uint8_t digest[20]); void CRYPT_SHA1Start(void* context); -void CRYPT_SHA1Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA1Update(void* context, const uint8_t* data, uint32_t size); void CRYPT_SHA1Finish(void* context, uint8_t digest[20]); void CRYPT_SHA256Generate(const uint8_t* data, - FX_DWORD size, + uint32_t size, uint8_t digest[32]); void CRYPT_SHA256Start(void* context); -void CRYPT_SHA256Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA256Update(void* context, const uint8_t* data, uint32_t size); void CRYPT_SHA256Finish(void* context, uint8_t digest[32]); void CRYPT_SHA384Start(void* context); -void CRYPT_SHA384Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA384Update(void* context, const uint8_t* data, uint32_t size); void CRYPT_SHA384Finish(void* context, uint8_t digest[48]); void CRYPT_SHA384Generate(const uint8_t* data, - FX_DWORD size, + uint32_t size, uint8_t digest[48]); void CRYPT_SHA512Start(void* context); -void CRYPT_SHA512Update(void* context, const uint8_t* data, FX_DWORD size); +void CRYPT_SHA512Update(void* context, const uint8_t* data, uint32_t size); void CRYPT_SHA512Finish(void* context, uint8_t digest[64]); void CRYPT_SHA512Generate(const uint8_t* data, - FX_DWORD size, + uint32_t size, uint8_t digest[64]); void CRYPT_SetPubKeyDecryptor(FX_BOOL (*func)(const uint8_t* pData, - FX_DWORD size, + uint32_t size, uint8_t* data_buf, - FX_DWORD& data_len)); + uint32_t& data_len)); #ifdef __cplusplus }; diff --git a/core/fpdfapi/fpdf_cmaps/cmap_int.h b/core/fpdfapi/fpdf_cmaps/cmap_int.h index 9b8db2154d..685d6fe4b1 100644 --- a/core/fpdfapi/fpdf_cmaps/cmap_int.h +++ b/core/fpdfapi/fpdf_cmaps/cmap_int.h @@ -26,7 +26,7 @@ void FPDFAPI_FindEmbeddedCMap(const char* name, int charset, int coding, const FXCMAP_CMap*& pMap); -uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode); -FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid); +uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode); +uint32_t FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid); #endif // CORE_FPDFAPI_FPDF_CMAPS_CMAP_INT_H_ diff --git a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp index 4e0737dbc2..3cd6106e1c 100644 --- a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp +++ b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp @@ -45,7 +45,7 @@ static int compareWordRange(const void* key, const void* element) { }; extern "C" { static int compareDWordRange(const void* p1, const void* p2) { - FX_DWORD key = *(FX_DWORD*)p1; + uint32_t key = *(uint32_t*)p1; uint16_t hiword = (uint16_t)(key >> 16); uint16_t* element = (uint16_t*)p2; if (hiword < element[0]) { @@ -66,8 +66,8 @@ static int compareDWordRange(const void* p1, const void* p2) { }; extern "C" { static int compareDWordSingle(const void* p1, const void* p2) { - FX_DWORD key = *(FX_DWORD*)p1; - FX_DWORD value = ((*(uint16_t*)p2) << 16) | ((uint16_t*)p2)[1]; + uint32_t key = *(uint32_t*)p1; + uint32_t value = ((*(uint16_t*)p2) << 16) | ((uint16_t*)p2)[1]; if (key < value) { return -1; } @@ -77,7 +77,7 @@ static int compareDWordSingle(const void* p1, const void* p2) { return 0; } }; -uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode) { +uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) { if (charcode >> 16) { while (1) { if (pMap->m_DWordMapType == FXCMAP_CMap::Range) { @@ -127,7 +127,7 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode) { } return 0; } -FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) { +uint32_t FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) { while (1) { if (pMap->m_WordMapType == FXCMAP_CMap::Single) { const uint16_t* pCur = pMap->m_pWordMap; @@ -159,7 +159,7 @@ FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) { const uint16_t* pEnd = pMap->m_pDWordMap + pMap->m_DWordCount * 4; while (pCur < pEnd) { if (cid >= pCur[3] && cid <= pCur[3] + pCur[2] - pCur[1]) { - return (((FX_DWORD)pCur[0] << 16) | pCur[1]) + cid - pCur[3]; + return (((uint32_t)pCur[0] << 16) | pCur[1]) + cid - pCur[3]; } pCur += 4; } @@ -168,7 +168,7 @@ FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) { const uint16_t* pEnd = pMap->m_pDWordMap + pMap->m_DWordCount * 3; while (pCur < pEnd) { if (pCur[2] == cid) { - return ((FX_DWORD)pCur[0] << 16) | pCur[1]; + return ((uint32_t)pCur[0] << 16) | pCur[1]; } pCur += 3; } @@ -183,7 +183,7 @@ FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) { void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset, const uint16_t*& pMap, - FX_DWORD& count) { + uint32_t& count) { CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); pMap = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap; diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp index 0ab34eab3c..5f53afd210 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -91,7 +91,7 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, buf << "q " << pImageObj->m_Matrix << " cm "; if (!pImageObj->m_pImage->IsInline()) { CPDF_Stream* pStream = pImageObj->m_pImage->GetStream(); - FX_DWORD dwSavedObjNum = pStream->GetObjNum(); + uint32_t dwSavedObjNum = pStream->GetObjNum(); CFX_ByteString name = RealizeResource(pStream, "XObject"); if (dwSavedObjNum == 0) { if (pImageObj->m_pImage) @@ -103,7 +103,7 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, } void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, const uint8_t* data, - FX_DWORD size, + uint32_t size, CFX_Matrix& matrix) { if (!data || !size) { return; diff --git a/core/fpdfapi/fpdf_edit/editint.h b/core/fpdfapi/fpdf_edit/editint.h index eaf93d12da..69a64b9aba 100644 --- a/core/fpdfapi/fpdf_edit/editint.h +++ b/core/fpdfapi/fpdf_edit/editint.h @@ -22,46 +22,46 @@ class CPDF_ObjectStream { FX_BOOL Start(); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object* pObj); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, + int32_t CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj); + int32_t CompressIndirectObject(uint32_t dwObjNum, const uint8_t* pBuffer, - FX_DWORD dwSize); + uint32_t dwSize); FX_FILESIZE End(CPDF_Creator* pCreator); - CFX_ArrayTemplate<FX_DWORD> m_ObjNumArray; + CFX_ArrayTemplate<uint32_t> m_ObjNumArray; CFX_ByteTextBuf m_Buffer; - FX_DWORD m_dwObjNum; + uint32_t m_dwObjNum; int32_t m_index; protected: - CFX_ArrayTemplate<FX_DWORD> m_OffsetArray; + CFX_ArrayTemplate<uint32_t> m_OffsetArray; }; class CPDF_XRefStream { public: struct Index { - FX_DWORD objnum; - FX_DWORD count; + uint32_t objnum; + uint32_t count; }; CPDF_XRefStream(); FX_BOOL Start(); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, + int32_t CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj, CPDF_Creator* pCreator); - int32_t CompressIndirectObject(FX_DWORD dwObjNum, + int32_t CompressIndirectObject(uint32_t dwObjNum, const uint8_t* pBuffer, - FX_DWORD dwSize, + uint32_t dwSize, CPDF_Creator* pCreator); FX_BOOL End(CPDF_Creator* pCreator, FX_BOOL bEOF = FALSE); - void AddObjectNumberToIndexArray(FX_DWORD objnum); + void AddObjectNumberToIndexArray(uint32_t objnum); FX_BOOL EndXRefStream(CPDF_Creator* pCreator); std::vector<Index> m_IndexArray; FX_FILESIZE m_PrevOffset; - FX_DWORD m_dwTempObjNum; + uint32_t m_dwTempObjNum; protected: int32_t EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF = TRUE); diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index f774d0119a..7dc90601c4 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -95,7 +95,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, } offset += 1; const CPDF_Array* p = pObj->AsArray(); - for (FX_DWORD i = 0; i < p->GetCount(); i++) { + for (uint32_t i = 0; i < p->GetCount(); i++) { CPDF_Object* pElement = p->GetElement(i); if (pElement->GetObjNum()) { if (pFile->AppendString(" ") < 0) { @@ -278,7 +278,7 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, } int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, - FX_DWORD dwObjNum, + uint32_t dwObjNum, CFX_FileBufferArchive* pFile) { if (!pEncryptDict) { return 0; @@ -303,9 +303,9 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict, return offset; } -std::vector<uint8_t> PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2) { - std::vector<uint8_t> buffer(sizeof(FX_DWORD) * 4); - FX_DWORD* pBuffer = reinterpret_cast<FX_DWORD*>(buffer.data()); +std::vector<uint8_t> PDF_GenerateFileID(uint32_t dwSeed1, uint32_t dwSeed2) { + std::vector<uint8_t> buffer(sizeof(uint32_t) * 4); + uint32_t* pBuffer = reinterpret_cast<uint32_t*>(buffer.data()); void* pContext = FX_Random_MT_Start(dwSeed1); for (int i = 0; i < 2; ++i) *pBuffer++ = FX_Random_MT_Generate(pContext); @@ -338,7 +338,7 @@ void AppendIndex1(CFX_ByteTextBuf& buffer, FX_FILESIZE offset) { buffer.AppendByte(0); } -void AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t index) { +void AppendIndex2(CFX_ByteTextBuf& buffer, uint32_t objnum, int32_t index) { buffer.AppendByte(2); buffer.AppendByte(FX_GETBYTEOFFSET24(objnum)); buffer.AppendByte(FX_GETBYTEOFFSET16(objnum)); @@ -348,11 +348,11 @@ void AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t index) { buffer.AppendByte(FX_GETBYTEOFFSET0(index)); } -bool IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag) { +bool IsXRefNeedEnd(CPDF_XRefStream* pXRef, uint32_t flag) { if (!(flag & FPDFCREATE_INCREMENTAL)) return false; - FX_DWORD iCount = 0; + uint32_t iCount = 0; for (const auto& pair : pXRef->m_IndexArray) iCount += pair.count; @@ -391,12 +391,12 @@ class CPDF_FlateEncoder { ~CPDF_FlateEncoder(); FX_BOOL Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode); FX_BOOL Initialize(const uint8_t* pBuffer, - FX_DWORD size, + uint32_t size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream = FALSE); void CloneDict(); uint8_t* m_pData; - FX_DWORD m_dwSize; + uint32_t m_dwSize; CPDF_Dictionary* m_pDict; FX_BOOL m_bCloned; FX_BOOL m_bNewData; @@ -450,7 +450,7 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream, return TRUE; } FX_BOOL CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer, - FX_DWORD size, + uint32_t size, FX_BOOL bFlateEncode, FX_BOOL bXRefStream) { if (!bFlateEncode) { @@ -481,9 +481,9 @@ class CPDF_Encryptor { FX_BOOL Initialize(IPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, - FX_DWORD src_size); + uint32_t src_size); uint8_t* m_pData; - FX_DWORD m_dwSize; + uint32_t m_dwSize; FX_BOOL m_bNewBuf; }; CPDF_Encryptor::CPDF_Encryptor() { @@ -494,7 +494,7 @@ CPDF_Encryptor::CPDF_Encryptor() { FX_BOOL CPDF_Encryptor::Initialize(IPDF_CryptoHandler* pHandler, int objnum, uint8_t* src_data, - FX_DWORD src_size) { + uint32_t src_size) { if (src_size == 0) { return TRUE; } @@ -527,16 +527,16 @@ FX_BOOL CPDF_ObjectStream::Start() { m_index = 0; return TRUE; } -int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, +int32_t CPDF_ObjectStream::CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); m_Buffer << pObj; return 1; } -int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum, +int32_t CPDF_ObjectStream::CompressIndirectObject(uint32_t dwObjNum, const uint8_t* pBuffer, - FX_DWORD dwSize) { + uint32_t dwSize) { m_ObjNumArray.Add(dwObjNum); m_OffsetArray.Add(m_Buffer.GetLength()); m_Buffer.AppendBlock(pBuffer, dwSize); @@ -569,14 +569,14 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) { return -1; } offset += len; - if ((len = pFile->AppendDWord((FX_DWORD)iCount)) < 0) { + if ((len = pFile->AppendDWord((uint32_t)iCount)) < 0) { return -1; } offset += len; if (pFile->AppendString("/First ") < 0) { return -1; } - if ((len = pFile->AppendDWord((FX_DWORD)tempBuffer.GetLength())) < 0) { + if ((len = pFile->AppendDWord((uint32_t)tempBuffer.GetLength())) < 0) { return -1; } if (pFile->AppendString("/Length ") < 0) { @@ -585,7 +585,7 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) { offset += len + 15; if (!pCreator->m_bCompress && !pHandler) { if ((len = pFile->AppendDWord( - (FX_DWORD)(tempBuffer.GetLength() + m_Buffer.GetLength()))) < 0) { + (uint32_t)(tempBuffer.GetLength() + m_Buffer.GetLength()))) < 0) { return -1; } offset += len; @@ -640,7 +640,7 @@ FX_BOOL CPDF_XRefStream::Start() { m_iSeg = 0; return TRUE; } -int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, +int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj, CPDF_Creator* pCreator) { if (!pCreator) { @@ -653,9 +653,9 @@ int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, } return EndObjectStream(pCreator); } -int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum, +int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum, const uint8_t* pBuffer, - FX_DWORD dwSize, + uint32_t dwSize, CPDF_Creator* pCreator) { if (!pCreator) { return 0; @@ -676,7 +676,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) { return -1; } } - FX_DWORD& dwObjStmNum = m_ObjStream.m_dwObjNum; + uint32_t& dwObjStmNum = m_ObjStream.m_dwObjNum; if (!dwObjStmNum) { dwObjStmNum = ++pCreator->m_dwLastObjNum; } @@ -687,7 +687,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) { AppendIndex0(m_Buffer, true); m_dwTempObjNum++; } - FX_DWORD end_num = m_IndexArray.back().objnum + m_IndexArray.back().count; + uint32_t end_num = m_IndexArray.back().objnum + m_IndexArray.back().count; int index = 0; for (; m_dwTempObjNum < end_num; m_dwTempObjNum++) { FX_FILESIZE* offset = pCreator->m_ObjectOffset.GetPtrAt(m_dwTempObjNum); @@ -714,7 +714,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) { } for (auto it = m_IndexArray.begin() + m_iSeg; it != m_IndexArray.end(); ++it) { - for (FX_DWORD m = it->objnum; m < it->objnum + it->count; ++m) { + for (uint32_t m = it->objnum; m < it->objnum + it->count; ++m) { if (m_ObjStream.m_index >= iSize || m != m_ObjStream.m_ObjNumArray.ElementAt(it - m_IndexArray.begin())) { AppendIndex1(m_Buffer, pCreator->m_ObjectOffset[m]); @@ -737,7 +737,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) { FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, FX_BOOL bEOF) { FX_FILESIZE offset_tmp = pCreator->m_Offset; - FX_DWORD objnum = ++pCreator->m_dwLastObjNum; + uint32_t objnum = ++pCreator->m_dwLastObjNum; CFX_FileBufferArchive* pFile = &pCreator->m_File; FX_BOOL bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0; if (bIncremental) { @@ -846,7 +846,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, } offset += len; if (pCreator->m_pEncryptDict) { - FX_DWORD dwEncryptObjNum = pCreator->m_pEncryptDict->GetObjNum(); + uint32_t dwEncryptObjNum = pCreator->m_pEncryptDict->GetObjNum(); if (dwEncryptObjNum == 0) { dwEncryptObjNum = pCreator->m_dwEnryptObjNum; } @@ -880,7 +880,7 @@ FX_BOOL CPDF_XRefStream::End(CPDF_Creator* pCreator, FX_BOOL bEOF) { FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) { if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) { AppendIndex0(m_Buffer, true); - for (FX_DWORD i = 1; i < pCreator->m_dwLastObjNum + 1; i++) { + for (uint32_t i = 1; i < pCreator->m_dwLastObjNum + 1; i++) { FX_FILESIZE* offset = pCreator->m_ObjectOffset.GetPtrAt(i); if (offset) { AppendIndex1(m_Buffer, *offset); @@ -890,18 +890,18 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) { } } else { for (const auto& pair : m_IndexArray) { - for (FX_DWORD j = pair.objnum; j < pair.objnum + pair.count; ++j) + for (uint32_t j = pair.objnum; j < pair.objnum + pair.count; ++j) AppendIndex1(m_Buffer, pCreator->m_ObjectOffset[j]); } } return GenerateXRefStream(pCreator, FALSE); } -void CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum) { +void CPDF_XRefStream::AddObjectNumberToIndexArray(uint32_t objnum) { if (m_IndexArray.empty()) { m_IndexArray.push_back({objnum, 1}); return; } - FX_DWORD next_objnum = m_IndexArray.back().objnum + m_IndexArray.back().count; + uint32_t next_objnum = m_IndexArray.back().objnum + m_IndexArray.back().count; if (objnum == next_objnum) m_IndexArray.back().count += 1; else @@ -949,7 +949,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { if (!m_pXRefStream) return 1; - FX_DWORD objnum = pObj->GetObjNum(); + uint32_t objnum = pObj->GetObjNum(); if (m_pParser && m_pParser->GetObjectGenNum(objnum) > 0) return 1; @@ -983,9 +983,9 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) { return -1; return 0; } -int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, +int32_t CPDF_Creator::WriteIndirectObjectToStream(uint32_t objnum, const uint8_t* pBuffer, - FX_DWORD dwSize) { + uint32_t dwSize) { if (!m_pXRefStream) { return 1; } @@ -1006,7 +1006,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum, } return 0; } -int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) { +int32_t CPDF_Creator::AppendObjectNumberToXRef(uint32_t objnum) { if (!m_pXRefStream) { return 1; } @@ -1023,7 +1023,7 @@ int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) { return 0; } int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, - FX_DWORD objnum, + uint32_t objnum, IPDF_CryptoHandler* pCrypto) { CPDF_FlateEncoder encoder; encoder.Initialize(const_cast<CPDF_Stream*>(pStream->AsStream()), @@ -1033,7 +1033,7 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, encoder.m_dwSize)) { return -1; } - if ((FX_DWORD)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) { + if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) { encoder.CloneDict(); encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize); } @@ -1055,7 +1055,7 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream, m_Offset += len; return 1; } -int32_t CPDF_Creator::WriteIndirectObj(FX_DWORD objnum, +int32_t CPDF_Creator::WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj) { int32_t len = m_File.AppendDWord(objnum); if (len < 0) @@ -1091,7 +1091,7 @@ int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj) { } return WriteIndirectObj(pObj->GetObjNum(), pObj); } -int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, +int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt) { int32_t len = 0; @@ -1149,7 +1149,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, CPDF_Encryptor encryptor; IPDF_CryptoHandler* pHandler = m_pCryptoHandler; encryptor.Initialize(pHandler, objnum, encoder.m_pData, encoder.m_dwSize); - if ((FX_DWORD)encoder.m_pDict->GetIntegerBy("Length") != + if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) { encoder.CloneDict(); encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize); @@ -1198,7 +1198,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, } m_Offset += 1; const CPDF_Array* p = pObj->AsArray(); - for (FX_DWORD i = 0; i < p->GetCount(); i++) { + for (uint32_t i = 0; i < p->GetCount(); i++) { CPDF_Object* pElement = p->GetElement(i); if (pElement->GetObjNum()) { if (m_File.AppendString(" ") < 0) { @@ -1273,7 +1273,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, } return 1; } -int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { +int32_t CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) { if (m_pParser->IsObjectFreeOrNull(objnum)) return 0; @@ -1297,7 +1297,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { } } else { uint8_t* pBuffer; - FX_DWORD size; + uint32_t size; m_pParser->GetIndirectBinary(objnum, pBuffer, size); if (!pBuffer) { return 0; @@ -1340,11 +1340,11 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) { return 1; } int32_t CPDF_Creator::WriteOldObjs(IFX_Pause* pPause) { - FX_DWORD nLastObjNum = m_pParser->GetLastObjNum(); + uint32_t nLastObjNum = m_pParser->GetLastObjNum(); if (!m_pParser->IsValidObjectNumber(nLastObjNum)) return 0; - FX_DWORD objnum = (FX_DWORD)(uintptr_t)m_Pos; + uint32_t objnum = (uint32_t)(uintptr_t)m_Pos; for (; objnum <= nLastObjNum; ++objnum) { int32_t iRet = WriteOldIndirectObject(objnum); if (iRet < 0) @@ -1364,7 +1364,7 @@ int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause) { int32_t iCount = m_NewObjNumArray.GetSize(); int32_t index = (int32_t)(uintptr_t)m_Pos; while (index < iCount) { - FX_DWORD objnum = m_NewObjNumArray.ElementAt(index); + uint32_t objnum = m_NewObjNumArray.ElementAt(index); auto it = m_pDocument->m_IndirectObjs.find(objnum); if (it == m_pDocument->m_IndirectObjs.end()) { ++index; @@ -1386,9 +1386,9 @@ void CPDF_Creator::InitOldObjNumOffsets() { if (!m_pParser) { return; } - FX_DWORD j = 0; - FX_DWORD dwStart = 0; - FX_DWORD dwEnd = m_pParser->GetLastObjNum(); + uint32_t j = 0; + uint32_t dwStart = 0; + uint32_t dwEnd = m_pParser->GetLastObjNum(); while (dwStart <= dwEnd) { while (dwStart <= dwEnd && m_pParser->IsObjectFreeOrNull(dwStart)) dwStart++; @@ -1408,7 +1408,7 @@ void CPDF_Creator::InitNewObjNumOffsets() { FX_BOOL bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0; FX_BOOL bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0; for (const auto& pair : m_pDocument->m_IndirectObjs) { - const FX_DWORD objnum = pair.first; + const uint32_t objnum = pair.first; const CPDF_Object* pObj = pair.second; if (pObj->GetObjNum() == -1) continue; @@ -1427,7 +1427,7 @@ void CPDF_Creator::InitNewObjNumOffsets() { return; } int32_t i = 0; - FX_DWORD dwStartObjNum = 0; + uint32_t dwStartObjNum = 0; FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0; while (i < iCount) { dwStartObjNum = m_NewObjNumArray.ElementAt(i); @@ -1440,11 +1440,11 @@ void CPDF_Creator::InitNewObjNumOffsets() { if (i >= iCount) { return; } - FX_DWORD dwLastObjNum = dwStartObjNum; + uint32_t dwLastObjNum = dwStartObjNum; i++; FX_BOOL bNewStart = FALSE; for (; i < iCount; i++) { - FX_DWORD dwCurObjNum = m_NewObjNumArray.ElementAt(i); + uint32_t dwCurObjNum = m_NewObjNumArray.ElementAt(i); bool bExist = m_pParser && m_pParser->IsValidObjectNumber(dwCurObjNum) && m_ObjectOffset.GetPtrAt(dwCurObjNum); if (bExist || dwCurObjNum - dwLastObjNum > 1) { @@ -1460,12 +1460,12 @@ void CPDF_Creator::InitNewObjNumOffsets() { } m_ObjectOffset.Add(dwStartObjNum, dwLastObjNum - dwStartObjNum + 1); } -void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) { +void CPDF_Creator::AppendNewObjNum(uint32_t objbum) { int32_t iStart = 0, iFind = 0; int32_t iEnd = m_NewObjNumArray.GetUpperBound(); while (iStart <= iEnd) { int32_t iMid = (iStart + iEnd) / 2; - FX_DWORD dwMid = m_NewObjNumArray.ElementAt(iMid); + uint32_t dwMid = m_NewObjNumArray.ElementAt(iMid); if (objbum < dwMid) { iEnd = iMid - 1; } else { @@ -1473,7 +1473,7 @@ void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) { iFind = iMid + 1; break; } - FX_DWORD dwNext = m_NewObjNumArray.ElementAt(iMid + 1); + uint32_t dwNext = m_NewObjNumArray.ElementAt(iMid + 1); if (objbum < dwNext) { iFind = iMid + 1; break; @@ -1538,9 +1538,9 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) { IFX_FileRead* pSrcFile = m_pParser->GetFileAccess(); uint8_t buffer[4096]; - FX_DWORD src_size = (FX_DWORD)(uintptr_t)m_Pos; + uint32_t src_size = (uint32_t)(uintptr_t)m_Pos; while (src_size) { - FX_DWORD block_size = src_size > 4096 ? 4096 : src_size; + uint32_t block_size = src_size > 4096 ? 4096 : src_size; if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) { return -1; } @@ -1557,9 +1557,9 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) { if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_pParser->GetLastXRefOffset() == 0) { InitOldObjNumOffsets(); - FX_DWORD dwEnd = m_pParser->GetLastObjNum(); + uint32_t dwEnd = m_pParser->GetLastObjNum(); bool bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0; - for (FX_DWORD objnum = 0; objnum <= dwEnd; objnum++) { + for (uint32_t objnum = 0; objnum <= dwEnd; objnum++) { if (m_pParser->IsObjectFreeOrNull(objnum)) continue; @@ -1627,7 +1627,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) { } int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) { FXSYS_assert(m_iStage >= 80 || m_iStage < 90); - FX_DWORD dwLastObjNum = m_dwLastObjNum; + uint32_t dwLastObjNum = m_dwLastObjNum; if (m_iStage == 80) { m_XrefStart = m_Offset; if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) { @@ -1660,7 +1660,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) { } if (m_iStage == 81) { CFX_ByteString str; - FX_DWORD i = (FX_DWORD)(uintptr_t)m_Pos, j; + uint32_t i = (uint32_t)(uintptr_t)m_Pos, j; while (i <= dwLastObjNum) { while (i <= dwLastObjNum && !m_ObjectOffset.GetPtrAt(i)) { i++; @@ -1702,12 +1702,12 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) { int32_t i = (int32_t)(uintptr_t)m_Pos; while (i < iCount) { int32_t j = i; - FX_DWORD objnum = m_NewObjNumArray.ElementAt(i); + uint32_t objnum = m_NewObjNumArray.ElementAt(i); while (j < iCount) { if (++j == iCount) { break; } - FX_DWORD dwCurrent = m_NewObjNumArray.ElementAt(j); + uint32_t dwCurrent = m_NewObjNumArray.ElementAt(j); if (dwCurrent - objnum > 1) { break; } @@ -1817,7 +1817,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { if (m_File.AppendString("/Encrypt") < 0) { return -1; } - FX_DWORD dwObjNum = m_pEncryptDict->GetObjNum(); + uint32_t dwObjNum = m_pEncryptDict->GetObjNum(); if (dwObjNum == 0) { dwObjNum = m_pDocument->GetLastObjNum() + 1; } @@ -1870,7 +1870,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { } if ((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser && m_pParser->GetLastXRefOffset() == 0) { - FX_DWORD i = 0; + uint32_t i = 0; for (i = 0; i < m_dwLastObjNum; i++) { if (!m_ObjectOffset.GetPtrAt(i)) { continue; @@ -1902,7 +1902,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { int count = m_NewObjNumArray.GetSize(); int32_t i = 0; for (i = 0; i < count; i++) { - FX_DWORD objnum = m_NewObjNumArray.ElementAt(i); + uint32_t objnum = m_NewObjNumArray.ElementAt(i); if (m_File.AppendDWord(objnum) < 0) { return -1; } @@ -1920,7 +1920,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { return -1; } for (i = 0; i < count; i++) { - FX_DWORD objnum = m_NewObjNumArray.ElementAt(i); + uint32_t objnum = m_NewObjNumArray.ElementAt(i); FX_FILESIZE offset = m_ObjectOffset[objnum]; OutputIndex(&m_File, offset); } @@ -1956,12 +1956,12 @@ void CPDF_Creator::Clear() { } } -bool CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags) { +bool CPDF_Creator::Create(IFX_StreamWrite* pFile, uint32_t flags) { m_File.AttachFile(pFile); return Create(flags); } -bool CPDF_Creator::Create(FX_DWORD flags) { +bool CPDF_Creator::Create(uint32_t flags) { m_dwFlags = flags; m_iStage = 0; m_Offset = 0; @@ -1984,7 +1984,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { m_pIDArray->Add(pID1->Clone()); } else { std::vector<uint8_t> buffer = - PDF_GenerateFileID((FX_DWORD)(uintptr_t) this, m_dwLastObjNum); + PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); CFX_ByteStringC bsBuffer(buffer.data(), buffer.size()); m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument); } @@ -1999,7 +1999,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { return; } std::vector<uint8_t> buffer = - PDF_GenerateFileID((FX_DWORD)(uintptr_t) this, m_dwLastObjNum); + PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); CFX_ByteStringC bsBuffer(buffer.data(), buffer.size()); m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument); return; @@ -2009,7 +2009,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) { if (m_pEncryptDict->GetStringBy("Filter") == "Standard") { CPDF_StandardSecurityHandler handler; CFX_ByteString user_pass = m_pParser->GetPassword(); - FX_DWORD flag = PDF_ENCRYPT_CONTENT; + uint32_t flag = PDF_ENCRYPT_CONTENT; handler.OnCreate(m_pEncryptDict, m_pIDArray, (const uint8_t*)user_pass, user_pass.GetLength(), flag); if (m_bNewCrypto) { diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 8e1072aa00..0f75cb04a8 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -446,7 +446,7 @@ uint32_t FX_GetLangHashCode(const FX_CHAR* pStr) { return uHashCode; } struct FX_LANG2CS { - FX_DWORD uLang; + uint32_t uLang; int uCharset; } * FX_LPLANG2CS; static const FX_LANG2CS gs_FXLang2CharsetTable[] = { @@ -501,11 +501,11 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString& dest) { free(pBuffer); } FX_BOOL IsHasCharSet(CFArrayRef languages, - const CFX_ArrayTemplate<FX_DWORD>& charSets) { + const CFX_ArrayTemplate<uint32_t>& charSets) { int iCount = charSets.GetSize(); for (int i = 0; i < CFArrayGetCount(languages); ++i) { CFStringRef language = (CFStringRef)CFArrayGetValueAtIndex(languages, i); - FX_DWORD CharSet = FX_GetCharsetFromLang( + uint32_t CharSet = FX_GetCharsetFromLang( CFStringGetCStringPtr(language, kCFStringEncodingMacRoman), -1); for (int j = 0; j < iCount; ++j) { if (CharSet == charSets[j]) { @@ -572,7 +572,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, CFRelease(descriptor); return NULL; } - CFX_ArrayTemplate<FX_DWORD> charSets; + CFX_ArrayTemplate<uint32_t> charSets; charSets.Add(FXFONT_CHINESEBIG5_CHARSET); charSets.Add(FXFONT_GB2312_CHARSET); charSets.Add(FXFONT_HANGEUL_CHARSET); @@ -1008,7 +1008,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { } else { static const FX_CHAR stem_chars[] = {'i', 'I', '!', '1'}; const size_t count = sizeof(stem_chars) / sizeof(stem_chars[0]); - FX_DWORD glyph = pEncoding->GlyphFromCharCode(stem_chars[0]); + uint32_t glyph = pEncoding->GlyphFromCharCode(stem_chars[0]); nStemV = pFont->GetGlyphWidth(glyph); for (size_t i = 1; i < count; i++) { glyph = pEncoding->GlyphFromCharCode(stem_chars[i]); @@ -1076,7 +1076,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc, static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageDict, - CFX_ArrayTemplate<FX_DWORD>& pageList) { + CFX_ArrayTemplate<uint32_t>& pageList) { CPDF_Dictionary* pRoot = pDoc->GetRoot(); if (!pRoot) { return -1; @@ -1111,7 +1111,7 @@ static int InsertNewPage(CPDF_Document* pDoc, CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName("Type", "Page"); - FX_DWORD dwObjNum = AddIndirectObject(pDict); + uint32_t dwObjNum = AddIndirectObject(pDict); if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { ReleaseIndirectObject(dwObjNum); return NULL; diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h index ad776a2866..d6a1c1079a 100644 --- a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h +++ b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h @@ -30,7 +30,7 @@ class CPDF_Creator { ~CPDF_Creator(); void RemoveSecurity(); - bool Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0); + bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0); int32_t Continue(IFX_Pause* pPause = NULL); FX_BOOL SetFileVersion(int32_t fileVersion = 17); @@ -38,7 +38,7 @@ class CPDF_Creator { friend class CPDF_ObjectStream; friend class CPDF_XRefStream; - bool Create(FX_DWORD flags); + bool Create(uint32_t flags); void ResetStandardSecurity(); void Clear(); @@ -46,29 +46,29 @@ class CPDF_Creator { void InitNewObjNumOffsets(); void InitID(FX_BOOL bDefault = TRUE); - void AppendNewObjNum(FX_DWORD objbum); - int32_t AppendObjectNumberToXRef(FX_DWORD objnum); + void AppendNewObjNum(uint32_t objbum); + int32_t AppendObjectNumberToXRef(uint32_t objnum); int32_t WriteDoc_Stage1(IFX_Pause* pPause); int32_t WriteDoc_Stage2(IFX_Pause* pPause); int32_t WriteDoc_Stage3(IFX_Pause* pPause); int32_t WriteDoc_Stage4(IFX_Pause* pPause); - int32_t WriteOldIndirectObject(FX_DWORD objnum); + int32_t WriteOldIndirectObject(uint32_t objnum); int32_t WriteOldObjs(IFX_Pause* pPause); int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause); int32_t WriteIndirectObj(const CPDF_Object* pObj); - int32_t WriteDirectObj(FX_DWORD objnum, + int32_t WriteDirectObj(uint32_t objnum, const CPDF_Object* pObj, FX_BOOL bEncrypt = TRUE); int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); - int32_t WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); - int32_t WriteIndirectObjectToStream(FX_DWORD objnum, + int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj); + int32_t WriteIndirectObjectToStream(uint32_t objnum, const uint8_t* pBuffer, - FX_DWORD dwSize); + uint32_t dwSize); int32_t WriteStream(const CPDF_Object* pStream, - FX_DWORD objnum, + uint32_t objnum, IPDF_CryptoHandler* pCrypto); CPDF_Document* m_pDocument; @@ -76,7 +76,7 @@ class CPDF_Creator { FX_BOOL m_bCompress; FX_BOOL m_bSecurityChanged; CPDF_Dictionary* m_pEncryptDict; - FX_DWORD m_dwEnryptObjNum; + uint32_t m_dwEnryptObjNum; FX_BOOL m_bEncryptCloned; FX_BOOL m_bStandardSecurity; IPDF_CryptoHandler* m_pCryptoHandler; @@ -85,15 +85,15 @@ class CPDF_Creator { CPDF_Object* m_pMetadata; CPDF_XRefStream* m_pXRefStream; int32_t m_ObjectStreamSize; - FX_DWORD m_dwLastObjNum; + uint32_t m_dwLastObjNum; CFX_FileBufferArchive m_File; FX_FILESIZE m_Offset; int32_t m_iStage; - FX_DWORD m_dwFlags; + uint32_t m_dwFlags; FX_POSITION m_Pos; FX_FILESIZE m_XrefStart; CFX_FileSizeListArray m_ObjectOffset; - CFX_ArrayTemplate<FX_DWORD> m_NewObjNumArray; + CFX_ArrayTemplate<uint32_t> m_NewObjNumArray; CPDF_Array* m_pIDArray; int32_t m_FileVersion; }; diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h b/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h index 53446c34e3..564a9ff54c 100644 --- a/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h +++ b/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h @@ -29,7 +29,7 @@ class CPDF_PageContentGenerator { void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj); void ProcessForm(CFX_ByteTextBuf& buf, const uint8_t* data, - FX_DWORD size, + uint32_t size, CFX_Matrix& matrix); CFX_ByteString RealizeResource(CPDF_Object* pResourceObj, const FX_CHAR* szType); diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index 956046c3be..9dd045ede9 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -124,7 +124,7 @@ bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) { FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, CIDSet charset, - FX_DWORD charcode) { + uint32_t charcode) { if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) return 0; @@ -143,7 +143,7 @@ FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap, return 0; } -FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, +uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, CIDSet charset, FX_WCHAR unicode) { if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset)) @@ -158,7 +158,7 @@ FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, int nCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count; for (int i = 0; i < nCodes; ++i) { if (pCodes[i] == unicode) { - FX_DWORD CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); + uint32_t CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i); if (CharCode != 0) { return CharCode; } @@ -234,7 +234,7 @@ CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() { return this; } -uint16_t CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const { +uint16_t CPDF_CIDFont::CIDFromCharCode(uint32_t charcode) const { if (!m_pCMap) { return (uint16_t)charcode; } @@ -245,7 +245,7 @@ FX_BOOL CPDF_CIDFont::IsVertWriting() const { return m_pCMap ? m_pCMap->IsVertWriting() : FALSE; } -CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(FX_DWORD charcode) const { +CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const { CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode); if (!str.IsEmpty()) return str; @@ -255,7 +255,7 @@ CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(FX_DWORD charcode) const { return ret; } -FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(FX_DWORD charcode) const { +FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const { switch (m_pCMap->m_Coding) { case CIDCODING_UCS2: case CIDCODING_UTF16: @@ -293,8 +293,8 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(FX_DWORD charcode) const { return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode)); } -FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { - FX_DWORD charcode = CPDF_Font::CharCodeFromUnicode(unicode); +uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { + uint32_t charcode = CPDF_Font::CharCodeFromUnicode(unicode); if (charcode) return charcode; switch (m_pCMap->m_Coding) { @@ -307,7 +307,7 @@ FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) { return 0; } - FX_DWORD CID = 0; + uint32_t CID = 0; while (CID < 65536) { FX_WCHAR this_unicode = m_pCID2UnicodeMap->UnicodeFromCID((uint16_t)CID); @@ -321,7 +321,7 @@ FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { } if (unicode < 0x80) { - return static_cast<FX_DWORD>(unicode); + return static_cast<uint32_t>(unicode); } if (m_pCMap->m_Coding == CIDCODING_CID) { return 0; @@ -466,7 +466,7 @@ FX_BOOL CPDF_CIDFont::Load() { return TRUE; } -FX_RECT CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, int level) { +FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode, int level) { if (charcode < 256 && m_CharBBox[charcode].right != FX_SMALL_RECT::kInvalid) return FX_RECT(m_CharBBox[charcode]); @@ -538,13 +538,13 @@ FX_RECT CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, int level) { return rect; } -int CPDF_CIDFont::GetCharWidthF(FX_DWORD charcode, int level) { +int CPDF_CIDFont::GetCharWidthF(uint32_t charcode, int level) { if (m_pAnsiWidths && charcode < 0x80) { return m_pAnsiWidths[charcode]; } uint16_t cid = CIDFromCharCode(charcode); int size = m_WidthList.GetSize(); - FX_DWORD* list = m_WidthList.GetData(); + uint32_t* list = m_WidthList.GetData(); for (int i = 0; i < size; i += 3) { if (cid >= list[i] && cid <= list[i + 1]) { return (int)list[i + 2]; @@ -553,31 +553,31 @@ int CPDF_CIDFont::GetCharWidthF(FX_DWORD charcode, int level) { return m_DefaultWidth; } short CPDF_CIDFont::GetVertWidth(uint16_t CID) const { - FX_DWORD vertsize = m_VertMetrics.GetSize() / 5; + uint32_t vertsize = m_VertMetrics.GetSize() / 5; if (vertsize == 0) { return m_DefaultW1; } - const FX_DWORD* pTable = m_VertMetrics.GetData(); - for (FX_DWORD i = 0; i < vertsize; i++) + const uint32_t* pTable = m_VertMetrics.GetData(); + for (uint32_t i = 0; i < vertsize; i++) if (pTable[i * 5] <= CID && pTable[i * 5 + 1] >= CID) { return (short)(int)pTable[i * 5 + 2]; } return m_DefaultW1; } void CPDF_CIDFont::GetVertOrigin(uint16_t CID, short& vx, short& vy) const { - FX_DWORD vertsize = m_VertMetrics.GetSize() / 5; + uint32_t vertsize = m_VertMetrics.GetSize() / 5; if (vertsize) { - const FX_DWORD* pTable = m_VertMetrics.GetData(); - for (FX_DWORD i = 0; i < vertsize; i++) + const uint32_t* pTable = m_VertMetrics.GetData(); + for (uint32_t i = 0; i < vertsize; i++) if (pTable[i * 5] <= CID && pTable[i * 5 + 1] >= CID) { vx = (short)(int)pTable[i * 5 + 3]; vy = (short)(int)pTable[i * 5 + 4]; return; } } - FX_DWORD dwWidth = m_DefaultWidth; + uint32_t dwWidth = m_DefaultWidth; int size = m_WidthList.GetSize(); - const FX_DWORD* list = m_WidthList.GetData(); + const uint32_t* list = m_WidthList.GetData(); for (int i = 0; i < size; i += 3) { if (CID >= list[i] && CID <= list[i + 1]) { dwWidth = (uint16_t)list[i + 2]; @@ -587,7 +587,7 @@ void CPDF_CIDFont::GetVertOrigin(uint16_t CID, short& vx, short& vy) const { vx = (short)dwWidth / 2; vy = (short)m_DefaultVY; } -int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL* pVertGlyph) { +int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, FX_BOOL* pVertGlyph) { if (pVertGlyph) { *pVertGlyph = FALSE; } @@ -637,7 +637,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL* pVertGlyph) { } return index; } -int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { +int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) { if (pVertGlyph) { *pVertGlyph = FALSE; } @@ -695,7 +695,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { if (bMSUnicode) { index = FXFT_Get_Char_Index(face, unicode); } else if (bMacRoman) { - FX_DWORD maccode = + uint32_t maccode = FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode); index = !maccode ? FXFT_Get_Name_Index(face, (char*)name) : FXFT_Get_Char_Index(face, maccode); @@ -726,7 +726,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { if (err != 0) { int i; for (i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) { - FX_DWORD ret = FT_CharCodeFromUnicode( + uint32_t ret = FT_CharCodeFromUnicode( FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]), (FX_WCHAR)charcode); if (ret == 0) { @@ -776,25 +776,25 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { return GetGlyphIndex(charcode, pVertGlyph); } } - FX_DWORD byte_pos = cid * 2; + uint32_t byte_pos = cid * 2; if (byte_pos + 2 > m_pCIDToGIDMap->GetSize()) return -1; const uint8_t* pdata = m_pCIDToGIDMap->GetData() + byte_pos; return pdata[0] * 256 + pdata[1]; } -FX_DWORD CPDF_CIDFont::GetNextChar(const FX_CHAR* pString, +uint32_t CPDF_CIDFont::GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { return m_pCMap->GetNextChar(pString, nStrLen, offset); } -int CPDF_CIDFont::GetCharSize(FX_DWORD charcode) const { +int CPDF_CIDFont::GetCharSize(uint32_t charcode) const { return m_pCMap->GetCharSize(charcode); } int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const { return m_pCMap->CountChar(pString, size); } -int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const { +int CPDF_CIDFont::AppendChar(FX_CHAR* str, uint32_t charcode) const { return m_pCMap->AppendChar(str, charcode); } FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const { @@ -804,7 +804,7 @@ FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const { } return TRUE; } -FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const { +FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(uint32_t charcode) const { return TRUE; } void CPDF_CIDFont::LoadSubstFont() { @@ -812,14 +812,14 @@ void CPDF_CIDFont::LoadSubstFont() { g_CharsetCPs[m_Charset], IsVertWriting()); } void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, - CFX_ArrayTemplate<FX_DWORD>& result, + CFX_ArrayTemplate<uint32_t>& result, int nElements) { int width_status = 0; int iCurElement = 0; int first_code = 0; int last_code = 0; - FX_DWORD count = pArray->GetCount(); - for (FX_DWORD i = 0; i < count; i++) { + uint32_t count = pArray->GetCount(); + for (uint32_t i = 0; i < count; i++) { CPDF_Object* pObj = pArray->GetElementValue(i); if (!pObj) continue; @@ -828,8 +828,8 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, if (width_status != 1) return; - FX_DWORD count = pArray->GetCount(); - for (FX_DWORD j = 0; j < count; j += nElements) { + uint32_t count = pArray->GetCount(); + for (uint32_t j = 0; j < count; j += nElements) { result.Add(first_code); result.Add(first_code); for (int k = 0; k < nElements; k++) { diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.h b/core/fpdfapi/fpdf_font/cpdf_cidfont.h index 6405d2c342..9beb7cb107 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.h +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.h @@ -38,35 +38,35 @@ class CPDF_CIDFont : public CPDF_Font { bool IsCIDFont() const override; const CPDF_CIDFont* AsCIDFont() const override; CPDF_CIDFont* AsCIDFont() override; - int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override; - int GetCharWidthF(FX_DWORD charcode, int level = 0) override; - FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override; - FX_DWORD GetNextChar(const FX_CHAR* pString, + int GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph = NULL) override; + int GetCharWidthF(uint32_t charcode, int level = 0) override; + FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override; + uint32_t GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const override; int CountChar(const FX_CHAR* pString, int size) const override; - int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override; - int GetCharSize(FX_DWORD charcode) const override; + int AppendChar(FX_CHAR* str, uint32_t charcode) const override; + int GetCharSize(uint32_t charcode) const override; FX_BOOL IsVertWriting() const override; FX_BOOL IsUnicodeCompatible() const override; FX_BOOL Load() override; - CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const override; - FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const override; + CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override; + uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override; FX_BOOL LoadGB2312(); - uint16_t CIDFromCharCode(FX_DWORD charcode) const; + uint16_t CIDFromCharCode(uint32_t charcode) const; const uint8_t* GetCIDTransform(uint16_t CID) const; short GetVertWidth(uint16_t CID) const; void GetVertOrigin(uint16_t CID, short& vx, short& vy) const; - virtual FX_BOOL IsFontStyleFromCharCode(FX_DWORD charcode) const; + virtual FX_BOOL IsFontStyleFromCharCode(uint32_t charcode) const; protected: - int GetGlyphIndex(FX_DWORD unicodeb, FX_BOOL* pVertGlyph); + int GetGlyphIndex(uint32_t unicodeb, FX_BOOL* pVertGlyph); void LoadMetricsArray(CPDF_Array* pArray, - CFX_ArrayTemplate<FX_DWORD>& result, + CFX_ArrayTemplate<uint32_t>& result, int nElements); void LoadSubstFont(); - FX_WCHAR GetUnicodeFromCharCode(FX_DWORD charcode) const; + FX_WCHAR GetUnicodeFromCharCode(uint32_t charcode) const; CPDF_CMap* m_pCMap; CPDF_CMap* m_pAllocatedCMap; @@ -78,10 +78,10 @@ class CPDF_CIDFont : public CPDF_Font { uint16_t m_DefaultWidth; uint16_t* m_pAnsiWidths; FX_SMALL_RECT m_CharBBox[256]; - CFX_ArrayTemplate<FX_DWORD> m_WidthList; + CFX_ArrayTemplate<uint32_t> m_WidthList; short m_DefaultVY; short m_DefaultW1; - CFX_ArrayTemplate<FX_DWORD> m_VertMetrics; + CFX_ArrayTemplate<uint32_t> m_VertMetrics; FX_BOOL m_bAdobeCourierStd; CFX_CTTGSUBTable* m_pTTGSUBTable; }; diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index bb63966161..c52ce8ff93 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -121,16 +121,16 @@ int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const { return size; } -int CPDF_Font::GetCharSize(FX_DWORD charcode) const { +int CPDF_Font::GetCharSize(uint32_t charcode) const { return 1; } -int CPDF_Font::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { +int CPDF_Font::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) { ASSERT(false); return 0; } -int CPDF_Font::GlyphFromCharCodeExt(FX_DWORD charcode) { +int CPDF_Font::GlyphFromCharCodeExt(uint32_t charcode) { return GlyphFromCharCode(charcode); } @@ -145,12 +145,12 @@ FX_BOOL CPDF_Font::IsVertWriting() const { return bVertWriting; } -int CPDF_Font::AppendChar(FX_CHAR* buf, FX_DWORD charcode) const { +int CPDF_Font::AppendChar(FX_CHAR* buf, uint32_t charcode) const { *buf = (FX_CHAR)charcode; return 1; } -void CPDF_Font::AppendChar(CFX_ByteString& str, FX_DWORD charcode) const { +void CPDF_Font::AppendChar(CFX_ByteString& str, uint32_t charcode) const { char buf[4]; int len = AppendChar(buf, charcode); if (len == 1) { @@ -160,7 +160,7 @@ void CPDF_Font::AppendChar(CFX_ByteString& str, FX_DWORD charcode) const { } } -CFX_WideString CPDF_Font::UnicodeFromCharCode(FX_DWORD charcode) const { +CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const { if (!m_bToUnicodeLoaded) ((CPDF_Font*)this)->LoadUnicodeMap(); @@ -169,7 +169,7 @@ CFX_WideString CPDF_Font::UnicodeFromCharCode(FX_DWORD charcode) const { return CFX_WideString(); } -FX_DWORD CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const { +uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const { if (!m_bToUnicodeLoaded) ((CPDF_Font*)this)->LoadUnicodeMap(); @@ -237,7 +237,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) { return; const uint8_t* pFontData = m_pFontFile->GetData(); - FX_DWORD dwFontSize = m_pFontFile->GetSize(); + uint32_t dwFontSize = m_pFontFile->GetSize(); if (!m_Font.LoadEmbedded(pFontData, dwFontSize)) { m_pDocument->GetPageData()->ReleaseFontFileStreamAcc( const_cast<CPDF_Stream*>(m_pFontFile->GetStream()->AsStream())); @@ -305,7 +305,7 @@ int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) { int offset = 0; int width = 0; while (offset < size) { - FX_DWORD charcode = GetNextChar(pString, size, offset); + uint32_t charcode = GetNextChar(pString, size, offset); width += GetCharWidthF(charcode); } return width; @@ -387,14 +387,14 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, return pFont; } -FX_DWORD CPDF_Font::GetNextChar(const FX_CHAR* pString, +uint32_t CPDF_Font::GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { if (offset < 0 || nStrLen < 1) { return 0; } uint8_t ch = offset < nStrLen ? pString[offset++] : pString[nStrLen - 1]; - return static_cast<FX_DWORD>(ch); + return static_cast<uint32_t>(ch); } void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, @@ -450,8 +450,8 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, return; } pCharNames = new CFX_ByteString[256]; - FX_DWORD cur_code = 0; - for (FX_DWORD i = 0; i < pDiffs->GetCount(); i++) { + uint32_t cur_code = 0; + for (uint32_t i = 0; i < pDiffs->GetCount(); i++) { CPDF_Object* pElement = pDiffs->GetElementValue(i); if (!pElement) continue; diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp index 64e11e09de..3fc16a2c43 100644 --- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp @@ -1631,8 +1631,8 @@ const FX_CHAR* const ZapfEncodingNames[224] = { "a182", NULL, "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", NULL}; -FX_DWORD PDF_FindCode(const uint16_t* pCodes, uint16_t unicode) { - for (FX_DWORD i = 0; i < 256; i++) +uint32_t PDF_FindCode(const uint16_t* pCodes, uint16_t unicode) { + for (uint32_t i = 0; i < 256; i++) if (pCodes[i] == unicode) return i; return 0; @@ -1713,7 +1713,7 @@ CPDF_Object* CPDF_FontEncoding::Realize() { return pDict; } -FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) { +uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) { switch (encoding) { case FXFT_ENCODING_UNICODE: return unicode; @@ -1796,7 +1796,7 @@ const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, return nullptr; } -FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode) { +FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode) { switch (encoding) { case FXFT_ENCODING_UNICODE: return (uint16_t)charcode; diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp index d7057e1894..baac366e2a 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp @@ -22,7 +22,7 @@ CPDF_SimpleFont::~CPDF_SimpleFont() { delete[] m_pCharNames; } -int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) { +int CPDF_SimpleFont::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) { if (pVertGlyph) { *pVertGlyph = FALSE; } @@ -82,7 +82,7 @@ void CPDF_SimpleFont::LoadCharMetrics(int charcode) { } } -int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) { +int CPDF_SimpleFont::GetCharWidthF(uint32_t charcode, int level) { if (charcode > 0xff) { charcode = 0; } @@ -95,7 +95,7 @@ int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) { return (int16_t)m_CharWidth[charcode]; } -FX_RECT CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, int level) { +FX_RECT CPDF_SimpleFont::GetCharBBox(uint32_t charcode, int level) { if (charcode > 0xff) charcode = 0; @@ -204,7 +204,7 @@ FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const { m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS; } -CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(FX_DWORD charcode) const { +CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const { CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode); if (!unicode.IsEmpty()) return unicode; @@ -214,8 +214,8 @@ CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(FX_DWORD charcode) const { return ret; } -FX_DWORD CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { - FX_DWORD ret = CPDF_Font::CharCodeFromUnicode(unicode); +uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { + uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode); if (ret) return ret; return m_Encoding.CharCodeFromUnicode(unicode); diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.h b/core/fpdfapi/fpdf_font/cpdf_simplefont.h index 19d6816c9f..7b07c9971e 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.h +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.h @@ -18,12 +18,12 @@ class CPDF_SimpleFont : public CPDF_Font { virtual ~CPDF_SimpleFont(); // CPDF_Font: - int GetCharWidthF(FX_DWORD charcode, int level = 0) override; - FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override; - int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override; + int GetCharWidthF(uint32_t charcode, int level = 0) override; + FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override; + int GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph = NULL) override; FX_BOOL IsUnicodeCompatible() const override; - CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const override; - FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const override; + CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override; + uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override; CPDF_FontEncoding* GetEncoding() { return &m_Encoding; } diff --git a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp index 13e031808e..032fa00e96 100644 --- a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp @@ -112,7 +112,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() { m_GlyphIndex[charcode] = FXFT_Get_Char_Index( m_Font.GetFace(), m_Encoding.m_Unicodes[charcode]); } else if (bMacRoman) { - FX_DWORD maccode = FT_CharCodeFromUnicode( + uint32_t maccode = FT_CharCodeFromUnicode( FXFT_ENCODING_APPLE_ROMAN, m_Encoding.m_Unicodes[charcode]); if (!maccode) { m_GlyphIndex[charcode] = diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp index 5a6ee34362..b2f3ec898b 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp @@ -102,7 +102,7 @@ FX_BOOL CPDF_Type1Font::Load() { return LoadCommon(); } -int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) { +int CPDF_Type1Font::GlyphFromCharCodeExt(uint32_t charcode) { if (charcode > 0xff) { return -1; } diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.h b/core/fpdfapi/fpdf_font/cpdf_type1font.h index da82cd4417..188b766c8a 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type1font.h +++ b/core/fpdfapi/fpdf_font/cpdf_type1font.h @@ -18,7 +18,7 @@ class CPDF_Type1Font : public CPDF_SimpleFont { bool IsType1Font() const override; const CPDF_Type1Font* AsType1Font() const override; CPDF_Type1Font* AsType1Font() override; - int GlyphFromCharCodeExt(FX_DWORD charcode) override; + int GlyphFromCharCodeExt(uint32_t charcode) override; int GetBase14Font() const { return m_Base14Font; } diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp index 91a03a9830..8591b87be4 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp @@ -57,14 +57,14 @@ FX_BOOL CPDF_Type3Font::Load() { int StartChar = m_pFontDict->GetIntegerBy("FirstChar"); CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); if (pWidthArray && (StartChar >= 0 && StartChar < 256)) { - FX_DWORD count = pWidthArray->GetCount(); + uint32_t count = pWidthArray->GetCount(); if (count > 256) { count = 256; } if (StartChar + count > 256) { count = 256 - StartChar; } - for (FX_DWORD i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { m_CharWidthL[StartChar + i] = FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000); } @@ -89,7 +89,7 @@ void CPDF_Type3Font::CheckType3FontMetrics() { CheckFontMetrics(); } -CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) { +CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode, int level) { if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_) return nullptr; @@ -145,7 +145,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) { return pCachedChar; } -int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) { +int CPDF_Type3Font::GetCharWidthF(uint32_t charcode, int level) { if (charcode >= FX_ArraySize(m_CharWidthL)) charcode = 0; @@ -156,7 +156,7 @@ int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) { return pChar ? pChar->m_Width : 0; } -FX_RECT CPDF_Type3Font::GetCharBBox(FX_DWORD charcode, int level) { +FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode, int level) { const CPDF_Type3Char* pChar = LoadChar(charcode, level); return pChar ? pChar->m_BBox : FX_RECT(); } diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.h b/core/fpdfapi/fpdf_font/cpdf_type3font.h index 554556934e..70992c9c8c 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type3font.h +++ b/core/fpdfapi/fpdf_font/cpdf_type3font.h @@ -25,13 +25,13 @@ class CPDF_Type3Font : public CPDF_SimpleFont { bool IsType3Font() const override; const CPDF_Type3Font* AsType3Font() const override; CPDF_Type3Font* AsType3Font() override; - int GetCharWidthF(FX_DWORD charcode, int level = 0) override; - FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override; + int GetCharWidthF(uint32_t charcode, int level = 0) override; + FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override; void SetPageResources(CPDF_Dictionary* pResources) { m_pPageResources = pResources; } - CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level = 0); + CPDF_Type3Char* LoadChar(uint32_t charcode, int level = 0); void CheckType3FontMetrics(); CFX_Matrix& GetFontMatrix() { return m_FontMatrix; } @@ -50,7 +50,7 @@ class CPDF_Type3Font : public CPDF_SimpleFont { CPDF_Dictionary* m_pCharProcs; CPDF_Dictionary* m_pPageResources; CPDF_Dictionary* m_pFontResources; - std::map<FX_DWORD, CPDF_Type3Char*> m_CacheMap; + std::map<uint32_t, CPDF_Type3Char*> m_CacheMap; }; #endif // CORE_FPDFAPI_FPDF_FONT_CPDF_TYPE3FONT_H_ diff --git a/core/fpdfapi/fpdf_font/font_int.h b/core/fpdfapi/fpdf_font/font_int.h index b9b5b5327d..3ee4068d7d 100644 --- a/core/fpdfapi/fpdf_font/font_int.h +++ b/core/fpdfapi/fpdf_font/font_int.h @@ -98,7 +98,7 @@ class CPDF_CMapParser { friend class fpdf_font_cid_CMap_GetCode_Test; friend class fpdf_font_cid_CMap_GetCodeRange_Test; - static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word); + static uint32_t CMap_GetCode(const CFX_ByteStringC& word); static bool CMap_GetCodeRange(CMap_CodeRange& range, const CFX_ByteStringC& first, const CFX_ByteStringC& second); @@ -106,7 +106,7 @@ class CPDF_CMapParser { CPDF_CMap* m_pCMap; int m_Status; int m_CodeSeq; - FX_DWORD m_CodePoints[4]; + uint32_t m_CodePoints[4]; CFX_ArrayTemplate<CMap_CodeRange> m_CodeRanges; CFX_ByteString m_Registry, m_Ordering, m_Supplement; CFX_ByteString m_LastWord; @@ -136,16 +136,16 @@ class CPDF_CMap { FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, FX_BOOL bPromptCJK); - FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize); + FX_BOOL LoadEmbedded(const uint8_t* pData, uint32_t dwSize); void Release(); FX_BOOL IsLoaded() const { return m_bLoaded; } FX_BOOL IsVertWriting() const { return m_bVertical; } - uint16_t CIDFromCharCode(FX_DWORD charcode) const; - FX_DWORD CharCodeFromCID(uint16_t CID) const; - int GetCharSize(FX_DWORD charcode) const; - FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; + uint16_t CIDFromCharCode(uint32_t charcode) const; + uint32_t CharCodeFromCID(uint16_t CID) const; + int GetCharSize(uint32_t charcode) const; + uint32_t 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; + int AppendChar(FX_CHAR* str, uint32_t charcode) const; protected: ~CPDF_CMap(); @@ -179,17 +179,17 @@ class CPDF_CID2UnicodeMap { protected: CIDSet m_Charset; const uint16_t* m_pEmbeddedMap; - FX_DWORD m_EmbeddedCount; + uint32_t m_EmbeddedCount; }; class CPDF_ToUnicodeMap { public: void Load(CPDF_Stream* pStream); - CFX_WideString Lookup(FX_DWORD charcode); - FX_DWORD ReverseLookup(FX_WCHAR unicode); + CFX_WideString Lookup(uint32_t charcode); + uint32_t ReverseLookup(FX_WCHAR unicode); protected: - std::map<FX_DWORD, FX_DWORD> m_Map; + std::map<uint32_t, uint32_t> m_Map; CPDF_CID2UnicodeMap* m_pBaseMap; CFX_WideTextBuf m_MultiCharBuf; @@ -197,12 +197,12 @@ class CPDF_ToUnicodeMap { friend class fpdf_font_StringToCode_Test; friend class fpdf_font_StringToWideString_Test; - static FX_DWORD StringToCode(const CFX_ByteStringC& str); + static uint32_t StringToCode(const CFX_ByteStringC& str); static CFX_WideString StringToWideString(const CFX_ByteStringC& str); }; void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset, const uint16_t*& pMap, - FX_DWORD& count); + uint32_t& count); #endif // CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_ diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index c0c6f520f4..b0659b4a52 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -90,25 +90,24 @@ short TT2PDF(int m, FXFT_Face face) { return (m * 1000 + upm / 2) / upm; } - -CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) { +CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) { auto it = m_Map.find(charcode); if (it != m_Map.end()) { - FX_DWORD value = it->second; + uint32_t value = it->second; FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff); if (unicode != 0xffff) { return unicode; } const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer(); - FX_DWORD buf_len = m_MultiCharBuf.GetLength(); + uint32_t buf_len = m_MultiCharBuf.GetLength(); if (!buf || buf_len == 0) { return CFX_WideString(); } - FX_DWORD index = value >> 16; + uint32_t index = value >> 16; if (index >= buf_len) { return CFX_WideString(); } - FX_DWORD len = buf[index]; + uint32_t len = buf[index]; if (index + len < index || index + len >= buf_len) { return CFX_WideString(); } @@ -120,7 +119,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) { return CFX_WideString(); } -FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { +uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { for (const auto& pair : m_Map) { if (pair.second == unicode) return pair.first; @@ -129,7 +128,7 @@ FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) { } // Static. -FX_DWORD CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { +uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) { const FX_CHAR* buf = str.GetCStr(); int len = str.GetLength(); if (len == 0) @@ -209,7 +208,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { if (word.IsEmpty() || word == "endbfchar") { break; } - FX_DWORD srccode = StringToCode(word); + uint32_t srccode = StringToCode(word); word = parser.GetWord(); CFX_WideString destcode = StringToWideString(word); int len = destcode.GetLength(); @@ -232,15 +231,15 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { break; } high = parser.GetWord(); - FX_DWORD lowcode = StringToCode(low); - FX_DWORD highcode = + uint32_t lowcode = StringToCode(low); + uint32_t highcode = (lowcode & 0xffffff00) | (StringToCode(high) & 0xff); - if (highcode == (FX_DWORD)-1) { + if (highcode == (uint32_t)-1) { break; } CFX_ByteString start = parser.GetWord(); if (start == "[") { - for (FX_DWORD code = lowcode; code <= highcode; code++) { + for (uint32_t code = lowcode; code <= highcode; code++) { CFX_ByteString dest = parser.GetWord(); CFX_WideString destcode = StringToWideString(dest); int len = destcode.GetLength(); @@ -259,14 +258,14 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { } else { CFX_WideString destcode = StringToWideString(start); int len = destcode.GetLength(); - FX_DWORD value = 0; + uint32_t value = 0; if (len == 1) { value = StringToCode(start); - for (FX_DWORD code = lowcode; code <= highcode; code++) { + for (uint32_t code = lowcode; code <= highcode; code++) { m_Map[code] = value++; } } else { - for (FX_DWORD code = lowcode; code <= highcode; code++) { + for (uint32_t code = lowcode; code <= highcode; code++) { CFX_WideString retcode; if (code == lowcode) { retcode = destcode; diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 95452a7227..2552a3c0a6 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -195,15 +195,15 @@ CFX_ByteString CMap_GetString(const CFX_ByteStringC& word) { } int CompareDWORD(const void* data1, const void* data2) { - return (*(FX_DWORD*)data1) - (*(FX_DWORD*)data2); + return (*(uint32_t*)data1) - (*(uint32_t*)data2); } int CompareCID(const void* key, const void* element) { - if ((*(FX_DWORD*)key) < (*(FX_DWORD*)element)) { + if ((*(uint32_t*)key) < (*(uint32_t*)element)) { return -1; } - if ((*(FX_DWORD*)key) > - (*(FX_DWORD*)element) + ((FX_DWORD*)element)[1] / 65536) { + if ((*(uint32_t*)key) > + (*(uint32_t*)element) + ((uint32_t*)element)[1] / 65536) { return 1; } return 0; @@ -237,7 +237,7 @@ int CheckCodeRange(uint8_t* codes, return 0; } -int GetCharSizeImpl(FX_DWORD charcode, +int GetCharSizeImpl(uint32_t charcode, CMap_CodeRange* pRanges, int iRangesSize) { if (!iRangesSize) @@ -379,7 +379,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { } else if (m_Status == 1 || m_Status == 2) { m_CodePoints[m_CodeSeq] = CMap_GetCode(word); m_CodeSeq++; - FX_DWORD StartCode, EndCode; + uint32_t StartCode, EndCode; uint16_t StartCID; if (m_Status == 1) { if (m_CodeSeq < 2) { @@ -396,11 +396,11 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { StartCID = (uint16_t)m_CodePoints[2]; } if (EndCode < 0x10000) { - for (FX_DWORD code = StartCode; code <= EndCode; code++) { + for (uint32_t code = StartCode; code <= EndCode; code++) { m_pCMap->m_pMapping[code] = (uint16_t)(StartCID + code - StartCode); } } else { - FX_DWORD buf[2]; + uint32_t buf[2]; buf[0] = StartCode; buf[1] = ((EndCode - StartCode) << 16) + StartCID; m_AddMaps.AppendBlock(buf, sizeof buf); @@ -451,7 +451,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { } // Static. -FX_DWORD CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) { +uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) { int num = 0; if (word.GetAt(0) == '<') { for (int i = 1; i < word.GetLength() && std::isxdigit(word.GetAt(i)); ++i) @@ -487,12 +487,12 @@ bool CPDF_CMapParser::CMap_GetCodeRange(CMap_CodeRange& range, range.m_Lower[i] = FXSYS_toHexDigit(digit1) * 16 + FXSYS_toHexDigit(digit2); } - FX_DWORD size = second.GetLength(); + uint32_t size = second.GetLength(); for (i = 0; i < range.m_CharSize; ++i) { - uint8_t digit1 = ((FX_DWORD)i * 2 + 1 < size) + uint8_t digit1 = ((uint32_t)i * 2 + 1 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 1) : '0'; - uint8_t digit2 = ((FX_DWORD)i * 2 + 2 < size) + uint8_t digit2 = ((uint32_t)i * 2 + 2 < size) ? second.GetAt((FX_STRSIZE)i * 2 + 2) : '0'; range.m_Upper[i] = FXSYS_toHexDigit(digit1) * 16 + FXSYS_toHexDigit(digit2); @@ -555,7 +555,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, m_CodingScheme = map->m_CodingScheme; if (m_CodingScheme == MixedTwoBytes) { m_pLeadingBytes = FX_Alloc(uint8_t, 256); - for (FX_DWORD i = 0; i < map->m_LeadingSegCount; ++i) { + for (uint32_t i = 0; i < map->m_LeadingSegCount; ++i) { const uint8_t* segs = map->m_LeadingSegs; for (int b = segs[i * 2]; b <= segs[i * 2 + 1]; ++b) { m_pLeadingBytes[b] = 1; @@ -569,7 +569,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, } return FALSE; } -FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) { +FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) { m_pMapping = FX_Alloc(uint16_t, 65536); CPDF_CMapParser parser; parser.Initialize(this); @@ -583,7 +583,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) { } if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) { m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4); - *(FX_DWORD*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; + *(uint32_t*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; FXSYS_memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m_AddMaps.GetSize()); FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, @@ -592,7 +592,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) { return TRUE; } -uint16_t CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const { +uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const { if (m_Coding == CIDCODING_CID) { return (uint16_t)charcode; } @@ -605,27 +605,27 @@ uint16_t CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const { if (charcode >> 16) { if (m_pAddMapping) { void* found = FXSYS_bsearch(&charcode, m_pAddMapping + 4, - *(FX_DWORD*)m_pAddMapping, 8, CompareCID); + *(uint32_t*)m_pAddMapping, 8, CompareCID); if (!found) { if (m_pUseMap) { return m_pUseMap->CIDFromCharCode(charcode); } return 0; } - return (uint16_t)(((FX_DWORD*)found)[1] % 65536 + charcode - - *(FX_DWORD*)found); + return (uint16_t)(((uint32_t*)found)[1] % 65536 + charcode - + *(uint32_t*)found); } if (m_pUseMap) return m_pUseMap->CIDFromCharCode(charcode); return 0; } - FX_DWORD CID = m_pMapping[charcode]; + uint32_t CID = m_pMapping[charcode]; if (!CID && m_pUseMap) return m_pUseMap->CIDFromCharCode(charcode); return (uint16_t)CID; } -FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString, +uint32_t CPDF_CMap::GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const { switch (m_CodingScheme) { @@ -654,7 +654,7 @@ FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString, return 0; } if (ret == 2) { - FX_DWORD charcode = 0; + uint32_t charcode = 0; for (int i = 0; i < char_size; i++) { charcode = (charcode << 8) + codes[i]; } @@ -670,7 +670,7 @@ FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString, } return 0; } -int CPDF_CMap::GetCharSize(FX_DWORD charcode) const { +int CPDF_CMap::GetCharSize(uint32_t charcode) const { switch (m_CodingScheme) { case OneByte: return 1; @@ -719,7 +719,7 @@ int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const { return size; } -int CPDF_CMap::AppendChar(FX_CHAR* str, FX_DWORD charcode) const { +int CPDF_CMap::AppendChar(FX_CHAR* str, uint32_t charcode) const { switch (m_CodingScheme) { case OneByte: str[0] = (uint8_t)charcode; diff --git a/core/fpdfapi/fpdf_font/include/cpdf_font.h b/core/fpdfapi/fpdf_font/include/cpdf_font.h index 1931c245de..79456aa7a5 100644 --- a/core/fpdfapi/fpdf_font/include/cpdf_font.h +++ b/core/fpdfapi/fpdf_font/include/cpdf_font.h @@ -39,7 +39,7 @@ class CPDF_Font { CPDF_Dictionary* pFontDict); static CPDF_Font* GetStockFont(CPDF_Document* pDoc, const CFX_ByteStringC& fontname); - static const FX_DWORD kInvalidCharCode = static_cast<FX_DWORD>(-1); + static const uint32_t kInvalidCharCode = static_cast<uint32_t>(-1); virtual ~CPDF_Font(); @@ -58,27 +58,27 @@ class CPDF_Font { virtual FX_BOOL IsVertWriting() const; virtual FX_BOOL IsUnicodeCompatible() const; - virtual FX_DWORD GetNextChar(const FX_CHAR* pString, + virtual uint32_t GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const; virtual int CountChar(const FX_CHAR* pString, int size) const; - virtual int AppendChar(FX_CHAR* buf, FX_DWORD charcode) const; - virtual int GetCharSize(FX_DWORD charcode) const; - virtual int GlyphFromCharCode(FX_DWORD charcode, + virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const; + virtual int GetCharSize(uint32_t charcode) const; + virtual int GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph = nullptr); - virtual int GlyphFromCharCodeExt(FX_DWORD charcode); - virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const; - virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const; + virtual int GlyphFromCharCodeExt(uint32_t charcode); + virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const; + virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; const CFX_ByteString& GetBaseFont() const { return m_BaseFont; } const CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); } - FX_DWORD GetFlags() const { return m_Flags; } + uint32_t GetFlags() const { return m_Flags; } FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; } CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; } CPDF_Dictionary* GetFontDict() const { return m_pFontDict; } FX_BOOL IsStandardFont() const; FXFT_Face GetFace() const { return m_Font.GetFace(); } - void AppendChar(CFX_ByteString& str, FX_DWORD charcode) const; + void AppendChar(CFX_ByteString& str, uint32_t charcode) const; void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; } int GetTypeAscent() const { return m_Ascent; } @@ -87,8 +87,8 @@ class CPDF_Font { int GetStemV() const { return m_StemV; } int GetStringWidth(const FX_CHAR* pString, int size); - virtual int GetCharWidthF(FX_DWORD charcode, int level = 0) = 0; - virtual FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) = 0; + virtual int GetCharWidthF(uint32_t charcode, int level = 0) = 0; + virtual FX_RECT GetCharBBox(uint32_t charcode, int level = 0) = 0; CPDF_Document* m_pDocument; CFX_Font m_Font; diff --git a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h b/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h index a64687cd0e..6d6ff43814 100644 --- a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h +++ b/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h @@ -20,8 +20,8 @@ #define PDFFONT_ENCODING_MS_SYMBOL 8 #define PDFFONT_ENCODING_UNICODE 9 -FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); -FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode); +uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); +FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode); FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/fpdfapi/fpdf_font/ttgsubtable.cpp index 24825ec14e..bb1a6f9f22 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -16,7 +16,7 @@ CFX_GlyphMap::CFX_GlyphMap() {} CFX_GlyphMap::~CFX_GlyphMap() {} extern "C" { static int _CompareInt(const void* p1, const void* p2) { - return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2); + return (*(uint32_t*)p1) - (*(uint32_t*)p2); } }; struct _IntPair { @@ -24,7 +24,7 @@ struct _IntPair { int32_t value; }; void CFX_GlyphMap::SetAt(int key, int value) { - FX_DWORD count = m_Buffer.GetSize() / sizeof(_IntPair); + uint32_t count = m_Buffer.GetSize() / sizeof(_IntPair); _IntPair* buf = (_IntPair*)m_Buffer.GetBuffer(); _IntPair pair = {key, value}; if (count == 0 || key > buf[count - 1].key) { @@ -52,7 +52,7 @@ FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) { if (!pResult) { return FALSE; } - value = ((FX_DWORD*)pResult)[1]; + value = ((uint32_t*)pResult)[1]; return TRUE; } bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) { @@ -82,7 +82,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyph(uint32_t glyphnum, k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) ->LangSys.FeatureCount; ++k) { - FX_DWORD index = + uint32_t index = *(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) ->LangSys.FeatureIndex + k); @@ -382,8 +382,8 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw, rec->Substitute[i] = GetUInt16(sp); } } -FX_BOOL CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum, - FX_DWORD* vglyphnum) { +FX_BOOL CFX_GSUBTable::GetVerticalGlyph(uint32_t glyphnum, + uint32_t* vglyphnum) { return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum); } // static diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.h b/core/fpdfapi/fpdf_font/ttgsubtable.h index e0bdcc75e2..56f3fc01ea 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/fpdfapi/fpdf_font/ttgsubtable.h @@ -344,7 +344,7 @@ class CFX_CTTGSUBTable { p += 4; return ret; } - std::map<FX_DWORD, FX_DWORD> m_featureMap; + std::map<uint32_t, uint32_t> m_featureMap; FX_BOOL m_bFeautureMapLoad; bool loaded; struct tt_gsub_header header; @@ -355,7 +355,7 @@ class CFX_CTTGSUBTable { class CFX_GSUBTable final : public IFX_GSUBTable { public: ~CFX_GSUBTable() override {} - FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override; + FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) override; CFX_CTTGSUBTable m_GsubImp; }; diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp index 5d02381d2e..159de584ee 100644 --- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp @@ -47,7 +47,7 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, CFX_GraphStateData* pData = m_GraphState.GetModify(); pData->m_DashPhase = phase * scale; pData->SetDashCount(pArray->GetCount()); - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; } } @@ -62,7 +62,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, if (!pObject) continue; - FX_DWORD key = key_str.GetID(); + uint32_t key = key_str.GetID(); switch (key) { case FXBSTR_ID('L', 'W', 0, 0): m_GraphState.GetModify()->m_LineWidth = pObject->GetNumber(); diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp index b1b464471d..3add21cfed 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp @@ -364,7 +364,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) { return ColorspaceFromName(familyname); CPDF_ColorSpace* pCS = NULL; - FX_DWORD id = familyname.GetID(); + uint32_t id = familyname.GetID(); if (id == FXBSTR_ID('C', 'a', 'l', 'G')) { pCS = new CPDF_CalGray(pDoc); } else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) { @@ -930,8 +930,8 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf, 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; + uint32_t color = i; + uint32_t order = nMaxColors / 52; for (int c = 0; c < m_nComponents; c++) { *pSrc++ = (uint8_t)(color / order * 5); color %= order; diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp index 81e5e41d60..7f80c82a03 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp @@ -25,7 +25,7 @@ void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS, } void CPDF_ColorState::SetColor(CPDF_Color& color, - FX_DWORD& rgb, + uint32_t& rgb, CPDF_ColorSpace* pCS, FX_FLOAT* pValue, int nValues) { @@ -39,7 +39,7 @@ void CPDF_ColorState::SetColor(CPDF_Color& color, } color.SetValue(pValue); int R, G, B; - rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1; + rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1; } void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, @@ -54,7 +54,7 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern, pData->m_FillRGB = 0x00BFBFBF; return; } - pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1; + pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (uint32_t)-1; } void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, @@ -70,5 +70,5 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern, return; } pData->m_StrokeRGB = - pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1; + pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1; } diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstate.h b/core/fpdfapi/fpdf_page/cpdf_colorstate.h index e7f3e37d35..2b27d07702 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorstate.h +++ b/core/fpdfapi/fpdf_page/cpdf_colorstate.h @@ -32,7 +32,7 @@ class CPDF_ColorState : public CFX_CountRef<CPDF_ColorStateData> { private: void SetColor(CPDF_Color& color, - FX_DWORD& rgb, + uint32_t& rgb, CPDF_ColorSpace* pCS, FX_FLOAT* pValue, int nValues); diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h b/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h index 96e43bd9f3..6a992ad0b1 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h +++ b/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h @@ -18,9 +18,9 @@ class CPDF_ColorStateData { void Default(); CPDF_Color m_FillColor; - FX_DWORD m_FillRGB; + uint32_t m_FillRGB; CPDF_Color m_StrokeColor; - FX_DWORD m_StrokeRGB; + uint32_t m_StrokeRGB; }; #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_COLORSTATEDATA_H_ diff --git a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp index 11c4dc7701..45a40cc85c 100644 --- a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp @@ -9,7 +9,7 @@ namespace { int RI_StringToId(const CFX_ByteString& ri) { - FX_DWORD id = ri.GetID(); + uint32_t id = ri.GetID(); if (id == FXBSTR_ID('A', 'b', 's', 'o')) return 1; diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp index 7b114841be..d5c97807e9 100644 --- a/core/fpdfapi/fpdf_page/cpdf_image.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp @@ -74,7 +74,7 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) { return TRUE; } -CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) { +CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) { int32_t width; int32_t height; int32_t num_comps; @@ -120,7 +120,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) { return pDict; } -void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) { +void CPDF_Image::SetJpegImage(uint8_t* pData, uint32_t size) { CPDF_Dictionary* pDict = InitJPEG(pData, size); if (!pDict) { return; @@ -129,11 +129,11 @@ void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) { } void CPDF_Image::SetJpegImage(IFX_FileRead* pFile) { - FX_DWORD size = (FX_DWORD)pFile->GetSize(); + uint32_t size = (uint32_t)pFile->GetSize(); if (!size) { return; } - FX_DWORD dwEstimateSize = size; + uint32_t dwEstimateSize = size; if (dwEstimateSize > 8192) { dwEstimateSize = 8192; } @@ -221,7 +221,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) { 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); + uint32_t argb = pBitmap->GetPaletteArgb(i); ptr[0] = (uint8_t)(argb >> 16); ptr[1] = (uint8_t)(argb >> 8); ptr[2] = (uint8_t)argb; @@ -357,9 +357,9 @@ void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) { } CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, - FX_DWORD* pMatteColor, + uint32_t* pMatteColor, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask) const { std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource); if (source->Load(m_pDocument, m_pStream, @@ -385,7 +385,7 @@ CFX_DIBSource* CPDF_Image::DetachMask() { FX_BOOL CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask) { std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource); int ret = diff --git a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp index 1d983d2b25..f4a1c16754 100644 --- a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp @@ -26,7 +26,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, if (!m_nCoordBits || !m_nCompBits) return FALSE; - FX_DWORD nComps = pCS->CountComponents(); + uint32_t nComps = pCS->CountComponents(); if (nComps > 8) return FALSE; @@ -44,14 +44,14 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream, m_xmax = pDecode->GetNumberAt(1); m_ymin = pDecode->GetNumberAt(2); m_ymax = pDecode->GetNumberAt(3); - for (FX_DWORD i = 0; i < m_nComps; i++) { + for (uint32_t i = 0; i < m_nComps; i++) { m_ColorMin[i] = pDecode->GetNumberAt(i * 2 + 4); m_ColorMax[i] = pDecode->GetNumberAt(i * 2 + 5); } return TRUE; } -FX_DWORD CPDF_MeshStream::GetFlag() { +uint32_t CPDF_MeshStream::GetFlag() { return m_BitStream.GetBits(m_nFlagBits) & 0x03; } @@ -70,7 +70,7 @@ void CPDF_MeshStream::GetCoords(FX_FLOAT& x, FX_FLOAT& y) { } void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) { - FX_DWORD i; + uint32_t i; FX_FLOAT color_value[8]; for (i = 0; i < m_nComps; i++) { color_value[i] = m_ColorMin[i] + @@ -82,7 +82,7 @@ void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) { FX_FLOAT result[kMaxResults]; int nResults; FXSYS_memset(result, 0, sizeof(result)); - for (FX_DWORD i = 0; i < m_nFuncs; i++) { + for (uint32_t i = 0; i < m_nFuncs; i++) { if (m_pFuncs[i] && m_pFuncs[i]->CountOutputs() <= kMaxResults) { m_pFuncs[i]->Call(color_value, 1, result, nResults); } @@ -93,9 +93,9 @@ void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) { } } -FX_DWORD CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex, +uint32_t CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap) { - FX_DWORD flag = GetFlag(); + uint32_t flag = GetFlag(); GetCoords(vertex.x, vertex.y); pObject2Bitmap->Transform(vertex.x, vertex.y); GetColor(vertex.r, vertex.g, vertex.b); diff --git a/core/fpdfapi/fpdf_page/cpdf_meshstream.h b/core/fpdfapi/fpdf_page/cpdf_meshstream.h index 4934c0b133..462dcf09c7 100644 --- a/core/fpdfapi/fpdf_page/cpdf_meshstream.h +++ b/core/fpdfapi/fpdf_page/cpdf_meshstream.h @@ -31,25 +31,25 @@ class CPDF_MeshStream { int nFuncs, CPDF_ColorSpace* pCS); - FX_DWORD GetFlag(); + uint32_t GetFlag(); void GetCoords(FX_FLOAT& x, FX_FLOAT& y); void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b); - FX_DWORD GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap); + uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap); FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex, int count, CFX_Matrix* pObject2Bitmap); CPDF_Function** m_pFuncs; CPDF_ColorSpace* m_pCS; - FX_DWORD m_nFuncs; - FX_DWORD m_nCoordBits; - FX_DWORD m_nCompBits; - FX_DWORD m_nFlagBits; - FX_DWORD m_nComps; - FX_DWORD m_CoordMax; - FX_DWORD m_CompMax; + uint32_t m_nFuncs; + uint32_t m_nCoordBits; + uint32_t m_nCompBits; + uint32_t m_nFlagBits; + uint32_t m_nComps; + uint32_t m_CoordMax; + uint32_t m_CompMax; FX_FLOAT m_xmin; FX_FLOAT m_xmax; FX_FLOAT m_ymin; diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp index cf588dcf3d..7ca03b4f05 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp @@ -25,7 +25,7 @@ CPDF_TextObject::~CPDF_TextObject() { void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const { pInfo->m_CharCode = - m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[index]; + m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[index]; pInfo->m_OriginX = index ? m_pCharPos[index - 1] : 0; pInfo->m_OriginY = 0; if (pInfo->m_CharCode == -1) { @@ -54,26 +54,26 @@ int CPDF_TextObject::CountChars() const { } int count = 0; for (int i = 0; i < m_nChars; ++i) - if (m_pCharCodes[i] != (FX_DWORD)-1) { + if (m_pCharCodes[i] != (uint32_t)-1) { ++count; } return count; } void CPDF_TextObject::GetCharInfo(int index, - FX_DWORD& charcode, + uint32_t& charcode, FX_FLOAT& kerning) const { if (m_nChars == 1) { - charcode = (FX_DWORD)(uintptr_t)m_pCharCodes; + charcode = (uint32_t)(uintptr_t)m_pCharCodes; kerning = 0; return; } int count = 0; for (int i = 0; i < m_nChars; ++i) { - if (m_pCharCodes[i] != (FX_DWORD)-1) { + if (m_pCharCodes[i] != (uint32_t)-1) { if (count == index) { charcode = m_pCharCodes[i]; - if (i == m_nChars - 1 || m_pCharCodes[i + 1] != (FX_DWORD)-1) { + if (i == m_nChars - 1 || m_pCharCodes[i + 1] != (uint32_t)-1) { kerning = 0; } else { kerning = m_pCharPos[i]; @@ -92,8 +92,8 @@ void CPDF_TextObject::GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const { } int count = 0; for (int i = 0; i < m_nChars; ++i) { - FX_DWORD charcode = m_pCharCodes[i]; - if (charcode == (FX_DWORD)-1) { + uint32_t charcode = m_pCharCodes[i]; + if (charcode == (uint32_t)-1) { continue; } if (count == index) { @@ -110,8 +110,8 @@ CPDF_TextObject* CPDF_TextObject::Clone() const { obj->m_nChars = m_nChars; if (m_nChars > 1) { - obj->m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars); - FXSYS_memcpy(obj->m_pCharCodes, m_pCharCodes, m_nChars * sizeof(FX_DWORD)); + obj->m_pCharCodes = FX_Alloc(uint32_t, m_nChars); + FXSYS_memcpy(obj->m_pCharCodes, m_pCharCodes, m_nChars * sizeof(uint32_t)); obj->m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1); FXSYS_memcpy(obj->m_pCharPos, m_pCharPos, (m_nChars - 1) * sizeof(FX_FLOAT)); @@ -145,7 +145,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, } m_nChars += nsegs - 1; if (m_nChars > 1) { - m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars); + m_pCharCodes = FX_Alloc(uint32_t, m_nChars); m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1); int index = 0; for (int i = 0; i < nsegs; ++i) { @@ -156,12 +156,12 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, } if (i != nsegs - 1) { m_pCharPos[index - 1] = pKerning[i]; - m_pCharCodes[index++] = (FX_DWORD)-1; + m_pCharCodes[index++] = (uint32_t)-1; } } } else { int offset = 0; - m_pCharCodes = (FX_DWORD*)(uintptr_t)pFont->GetNextChar( + m_pCharCodes = (uint32_t*)(uintptr_t)pFont->GetNextChar( pStrs[0], pStrs[0].GetLength(), offset); } } @@ -171,7 +171,7 @@ void CPDF_TextObject::SetText(const CFX_ByteString& str) { RecalcPositionData(); } -FX_FLOAT CPDF_TextObject::GetCharWidth(FX_DWORD charcode) const { +FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const { FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; CPDF_Font* pFont = m_TextState.GetFont(); FX_BOOL bVertWriting = FALSE; @@ -203,10 +203,10 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX, } FX_FLOAT fontsize = m_TextState.GetFontSize(); for (int i = 0; i < m_nChars; ++i) { - FX_DWORD charcode = - m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; + uint32_t charcode = + m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[i]; if (i > 0) { - if (charcode == (FX_DWORD)-1) { + if (charcode == (uint32_t)-1) { curpos -= (m_pCharPos[i - 1] * fontsize) / 1000; continue; } diff --git a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp index cc40976f29..224602ebc7 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -21,7 +21,7 @@ namespace { -FX_DWORD ComponentsForFamily(int family) { +uint32_t ComponentsForFamily(int family) { if (family == PDFCS_DEVICERGB) return 3; if (family == PDFCS_DEVICEGRAY) @@ -216,7 +216,7 @@ void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, } } -CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize) +CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize) : m_bsRGB(FALSE), m_pTransform(NULL), m_nSrcComponents(0) { if (dwSize == 3144 && FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) { diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 2e68702127..d762e1aa53 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -477,7 +477,7 @@ CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) { if (!pImageStream) return nullptr; - const FX_DWORD dwImageObjNum = pImageStream->GetObjNum(); + const uint32_t dwImageObjNum = pImageStream->GetObjNum(); auto it = m_ImageMap.find(dwImageObjNum); if (it != m_ImageMap.end()) { return it->second->AddRef(); diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp index 08eafad6ac..0fa2dd7712 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -490,7 +490,7 @@ static FX_FLOAT PDF_Interpolate(FX_FLOAT x, FX_FLOAT ymax) { return ((x - xmin) * (ymax - ymin) / (xmax - xmin)) + ymin; } -static FX_DWORD _GetBits32(const uint8_t* pData, int bitpos, int nbits) { +static uint32_t _GetBits32(const uint8_t* pData, int bitpos, int nbits) { int result = 0; for (int i = 0; i < nbits; i++) if (pData[(bitpos + i) / 8] & (1 << (7 - (bitpos + i) % 8))) { @@ -515,8 +515,8 @@ class CPDF_SampledFunc : public CPDF_Function { SampleEncodeInfo* m_pEncodeInfo; SampleDecodeInfo* m_pDecodeInfo; - FX_DWORD m_nBitsPerSample; - FX_DWORD m_SampleMax; + uint32_t m_nBitsPerSample; + uint32_t m_SampleMax; CPDF_StreamAcc* m_pSampleStream; }; @@ -632,7 +632,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const { return FALSE; } for (int j = 0; j < m_nOutputs; j++) { - FX_DWORD sample = + uint32_t sample = _GetBits32(pSampleData, bitpos.ValueOrDie() + j * m_nBitsPerSample, m_nBitsPerSample); FX_FLOAT encoded = (FX_FLOAT)sample; @@ -650,7 +650,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const { if (!bitpos2.IsValid()) { return FALSE; } - FX_DWORD sample1 = + uint32_t sample1 = _GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample); encoded += (encoded_input[i] - index[i]) * ((FX_FLOAT)sample1 - (FX_FLOAT)sample); @@ -770,12 +770,12 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { if (!pArray) { return FALSE; } - FX_DWORD nSubs = pArray->GetCount(); + uint32_t nSubs = pArray->GetCount(); if (nSubs == 0) { return FALSE; } m_nOutputs = 0; - for (FX_DWORD i = 0; i < nSubs; i++) { + for (uint32_t i = 0; i < nSubs; i++) { CPDF_Object* pSub = pArray->GetElementValue(i); if (pSub == pObj) { return FALSE; @@ -804,7 +804,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { if (!pArray) { return FALSE; } - for (FX_DWORD i = 0; i < nSubs - 1; i++) { + for (uint32_t i = 0; i < nSubs - 1; i++) { m_pBounds[i + 1] = pArray->GetFloatAt(i); } m_pBounds[nSubs] = m_pDomains[1]; @@ -813,7 +813,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) { if (!pArray) { return FALSE; } - for (FX_DWORD i = 0; i < nSubs * 2; i++) { + for (uint32_t i = 0; i < nSubs * 2; i++) { m_pEncode[i] = pArray->GetFloatAt(i); } return TRUE; @@ -900,7 +900,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) { m_pRanges[i] = pRanges->GetFloatAt(i); } } - FX_DWORD old_outputs = m_nOutputs; + uint32_t old_outputs = m_nOutputs; if (!v_Init(pObj)) { return FALSE; } diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 63c84bbd22..75b745222f 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -255,8 +255,8 @@ void CPDF_StreamContentParser::AddObjectParam(CPDF_Object* pObj) { m_ParamBuf[index].m_pObject = pObj; } void CPDF_StreamContentParser::ClearAllParams() { - FX_DWORD index = m_ParamStartPos; - for (FX_DWORD i = 0; i < m_ParamCount; i++) { + uint32_t index = m_ParamStartPos; + for (uint32_t i = 0; i < m_ParamCount; i++) { if (m_ParamBuf[index].m_Type == 0) { if (CPDF_Object* pObject = m_ParamBuf[index].m_pObject) pObject->Release(); @@ -270,7 +270,7 @@ void CPDF_StreamContentParser::ClearAllParams() { m_ParamCount = 0; } -CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) { +CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) { if (index >= m_ParamCount) { return NULL; } @@ -302,7 +302,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) { return NULL; } -CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index) { +CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) { if (index >= m_ParamCount) { return CFX_ByteString(); } @@ -320,7 +320,7 @@ CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index) { return CFX_ByteString(); } -FX_FLOAT CPDF_StreamContentParser::GetNumber(FX_DWORD index) { +FX_FLOAT CPDF_StreamContentParser::GetNumber(uint32_t index) { if (index >= m_ParamCount) { return 0; } @@ -339,7 +339,7 @@ FX_FLOAT CPDF_StreamContentParser::GetNumber(FX_DWORD index) { return 0; } -FX_FLOAT CPDF_StreamContentParser::GetNumber16(FX_DWORD index) { +FX_FLOAT CPDF_StreamContentParser::GetNumber16(uint32_t index) { return GetNumber(index); } @@ -484,7 +484,7 @@ CPDF_StreamContentParser::InitializeOpCodes() { void CPDF_StreamContentParser::OnOperator(const FX_CHAR* op) { int i = 0; - FX_DWORD opid = 0; + uint32_t opid = 0; while (i < 4 && op[i]) { opid = (opid << 8) + op[i]; i++; @@ -574,7 +574,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() { std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj( m_pSyntax->ReadNextObject()); if (!key.IsEmpty()) { - FX_DWORD dwObjNum = pObj ? pObj->GetObjNum() : 0; + uint32_t dwObjNum = pObj ? pObj->GetObjNum() : 0; if (dwObjNum) pDict->SetAtReference(key, m_pDocument, dwObjNum); else @@ -1645,17 +1645,17 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) { } } -FX_DWORD CPDF_StreamContentParser::Parse(const uint8_t* pData, - FX_DWORD dwSize, - FX_DWORD max_cost) { +uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData, + uint32_t dwSize, + uint32_t max_cost) { if (m_Level > _FPDF_MAX_FORM_LEVEL_) { return dwSize; } - FX_DWORD InitObjCount = m_pObjectHolder->GetPageObjectList()->size(); + uint32_t InitObjCount = m_pObjectHolder->GetPageObjectList()->size(); CPDF_StreamParser syntax(pData, dwSize); CPDF_StreamParserAutoClearer auto_clearer(&m_pSyntax, &syntax); while (1) { - FX_DWORD cost = m_pObjectHolder->GetPageObjectList()->size() - InitObjCount; + uint32_t cost = m_pObjectHolder->GetPageObjectList()->size() - InitObjCount; if (max_cost && cost >= max_cost) { break; } @@ -1810,7 +1810,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) { } case CPDF_Object::ARRAY: { CPDF_Array* pArray = pObj->AsArray(); - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { CPDF_Object* pElement = pArray->GetElement(i); if (pElement->IsName()) { CFX_ByteString name = pElement->GetString(); diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 9995038def..f2b7582a01 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -31,7 +31,7 @@ #include "core/fxcrt/include/fx_safe_types.h" #include "core/include/fxcodec/fx_codec.h" -CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize) { +CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize) { m_pBuf = pData; m_Size = dwSize; m_Pos = 0; @@ -44,11 +44,11 @@ CPDF_StreamParser::~CPDF_StreamParser() { } } -FX_DWORD DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, +uint32_t DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { if (!pDecoder) { - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } int ncomps = pDecoder->CountComps(); int bpc = pDecoder->GetBPC(); @@ -57,7 +57,7 @@ FX_DWORD DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, int pitch = (width * ncomps * bpc + 7) / 8; if (height == 0 || pitch > (1 << 30) / height) { delete pDecoder; - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } dest_buf = FX_Alloc2D(uint8_t, pitch, height); dest_size = pitch * height; // Safe since checked alloc returned. @@ -68,26 +68,26 @@ FX_DWORD DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FXSYS_memcpy(dest_buf + row * pitch, pLine, pitch); } - FX_DWORD srcoff = pDecoder->GetSrcOffset(); + uint32_t srcoff = pDecoder->GetSrcOffset(); delete pDecoder; return srcoff; } ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, const CPDF_Dictionary* pParams); -FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, - FX_DWORD limit, +uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf, + uint32_t limit, int width, int height, CFX_ByteString& decoder, CPDF_Dictionary* pParam, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { if (decoder == "CCITTFaxDecode" || decoder == "CCF") { ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam); @@ -119,7 +119,7 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, } dest_size = 0; dest_buf = 0; - return (FX_DWORD)-1; + return (uint32_t)-1; } CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, @@ -146,12 +146,12 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, pParam = pDict->GetDictBy("DecodeParms"); } } - FX_DWORD width = pDict->GetIntegerBy("Width"); - FX_DWORD height = pDict->GetIntegerBy("Height"); - FX_DWORD OrigSize = 0; + uint32_t width = pDict->GetIntegerBy("Width"); + uint32_t height = pDict->GetIntegerBy("Height"); + uint32_t OrigSize = 0; if (pCSObj) { - FX_DWORD bpc = pDict->GetIntegerBy("BitsPerComponent"); - FX_DWORD nComponents = 1; + uint32_t bpc = pDict->GetIntegerBy("BitsPerComponent"); + uint32_t nComponents = 1; CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj); if (!pCS) { nComponents = 3; @@ -159,7 +159,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, nComponents = pCS->CountComponents(); pDoc->GetPageData()->ReleaseColorSpace(pCSObj); } - FX_DWORD pitch = width; + uint32_t pitch = width; if (bpc && pitch > INT_MAX / bpc) { return NULL; } @@ -185,7 +185,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, } OrigSize *= height; uint8_t* pData = NULL; - FX_DWORD dwStreamSize; + uint32_t dwStreamSize; if (Decoder.IsEmpty()) { if (OrigSize > m_Size - m_Pos) { OrigSize = m_Size - m_Pos; @@ -195,7 +195,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, dwStreamSize = OrigSize; m_Pos += OrigSize; } else { - FX_DWORD dwDestSize = OrigSize; + uint32_t dwDestSize = OrigSize; dwStreamSize = PDF_DecodeInlineStream(m_pBuf + m_Pos, m_Size - m_Pos, width, height, Decoder, pParam, pData, dwDestSize); @@ -217,10 +217,10 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, } } else { FX_Free(pData); - FX_DWORD dwSavePos = m_Pos; + uint32_t dwSavePos = m_Pos; m_Pos += dwStreamSize; while (1) { - FX_DWORD dwPrevPos = m_Pos; + uint32_t dwPrevPos = m_Pos; CPDF_StreamParser::SyntaxType type = ParseNextElement(); if (type == CPDF_StreamParser::EndOfData) { break; @@ -332,7 +332,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() { } void CPDF_StreamParser::SkipPathObject() { - FX_DWORD command_startpos = m_Pos; + uint32_t command_startpos = m_Pos; if (!PositionIsInBounds()) return; @@ -365,7 +365,7 @@ void CPDF_StreamParser::SkipPathObject() { if (PDFCharIsNumeric(ch)) continue; - FX_DWORD op_startpos = m_Pos - 1; + uint32_t op_startpos = m_Pos - 1; while (!PDFCharIsWhitespace(ch) && !PDFCharIsDelimiter(ch)) { if (!PositionIsInBounds()) return; @@ -808,7 +808,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { } m_Size = safeSize.ValueOrDie(); m_pData = FX_Alloc(uint8_t, m_Size); - FX_DWORD pos = 0; + uint32_t pos = 0; for (const auto& stream : m_StreamArray) { FXSYS_memcpy(m_pData + pos, stream->GetData(), stream->GetSize()); pos += stream->GetSize(); diff --git a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 822d06d84c..68ac8c849d 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -58,7 +58,7 @@ CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream, color_count = kQuadColorsPerPatch; while (!stream.m_BitStream.IsEOF()) { - FX_DWORD flag = 0; + uint32_t flag = 0; if (type != kLatticeFormGouraudTriangleMeshShading) flag = stream.GetFlag(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_clippath.h b/core/fpdfapi/fpdf_page/include/cpdf_clippath.h index e265cd4ce0..6f239e661f 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_clippath.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_clippath.h @@ -17,10 +17,10 @@ class CPDF_TextObject; class CPDF_ClipPath : public CFX_CountRef<CPDF_ClipPathData> { public: - FX_DWORD GetPathCount() const { return m_pObject->m_PathCount; } + uint32_t GetPathCount() const { return m_pObject->m_PathCount; } CPDF_Path GetPath(int i) const { return m_pObject->m_pPathList[i]; } int GetClipType(int i) const { return m_pObject->m_pTypeList[i]; } - FX_DWORD GetTextCount() const { return m_pObject->m_TextCount; } + uint32_t GetTextCount() const { return m_pObject->m_TextCount; } CPDF_TextObject* GetText(int i) const { return m_pObject->m_pTextList[i]; } CFX_FloatRect GetClipBox() const; diff --git a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h index afdd71dc4d..6be55f47b9 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h @@ -37,7 +37,7 @@ class CPDF_ColorSpace { int GetBufSize() const; FX_FLOAT* CreateBuf(); void GetDefaultColor(FX_FLOAT* buf) const; - FX_DWORD CountComponents() const { return m_nComponents; } + uint32_t CountComponents() const { return m_nComponents; } int GetFamily() const { return m_Family; } virtual void GetDefaultValue(int iComponent, FX_FLOAT& value, @@ -87,7 +87,7 @@ class CPDF_ColorSpace { CPDF_Document* const m_pDocument; protected: - CPDF_ColorSpace(CPDF_Document* pDoc, int family, FX_DWORD nComponents) + CPDF_ColorSpace(CPDF_Document* pDoc, int family, uint32_t nComponents) : m_pDocument(pDoc), m_Family(family), m_nComponents(nComponents), @@ -114,9 +114,9 @@ class CPDF_ColorSpace { } int m_Family; - FX_DWORD m_nComponents; + uint32_t m_nComponents; CPDF_Array* m_pArray; - FX_DWORD m_dwStdConversion; + uint32_t m_dwStdConversion; }; #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLORSPACE_H_ diff --git a/core/fpdfapi/fpdf_page/include/cpdf_image.h b/core/fpdfapi/fpdf_page/include/cpdf_image.h index 9153e9a660..48349deb3b 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_image.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_image.h @@ -52,14 +52,14 @@ class CPDF_Image { FX_BOOL IsInterpol() const { return m_bInterpolate; } CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = NULL, - FX_DWORD* pMatteColor = NULL, + uint32_t* pMatteColor = NULL, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE) const; void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; } void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress); - void SetJpegImage(uint8_t* pImageData, FX_DWORD size); + void SetJpegImage(uint8_t* pImageData, uint32_t size); void SetJpegImage(IFX_FileRead* pFile); void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap); @@ -67,7 +67,7 @@ class CPDF_Image { FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE); FX_BOOL Continue(IFX_Pause* pPause); CFX_DIBSource* DetachBitmap(); @@ -75,10 +75,10 @@ class CPDF_Image { CFX_DIBSource* m_pDIBSource; CFX_DIBSource* m_pMask; - FX_DWORD m_MatteColor; + uint32_t m_MatteColor; private: - CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); + CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size); CPDF_Stream* m_pStream; FX_BOOL m_bInline; diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h index bb268c1446..c47180ef6b 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h @@ -12,7 +12,7 @@ #include "core/fxcrt/include/fx_system.h" struct CPDF_TextObjectItem { - FX_DWORD m_CharCode; + uint32_t m_CharCode; FX_FLOAT m_OriginX; FX_FLOAT m_OriginY; }; @@ -33,9 +33,9 @@ class CPDF_TextObject : public CPDF_PageObject { int CountItems() const { return m_nChars; } void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const; int CountChars() const; - void GetCharInfo(int index, FX_DWORD& charcode, FX_FLOAT& kerning) const; + void GetCharInfo(int index, uint32_t& charcode, FX_FLOAT& kerning) const; void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const; - FX_FLOAT GetCharWidth(FX_DWORD charcode) const; + FX_FLOAT GetCharWidth(uint32_t charcode) const; FX_FLOAT GetPosX() const { return m_PosX; } FX_FLOAT GetPosY() const { return m_PosY; } void GetTextMatrix(CFX_Matrix* pMatrix) const; @@ -62,7 +62,7 @@ class CPDF_TextObject : public CPDF_PageObject { FX_FLOAT m_PosX; FX_FLOAT m_PosY; int m_nChars; - FX_DWORD* m_pCharCodes; + uint32_t* m_pCharCodes; FX_FLOAT* m_pCharPos; }; diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h index 297b1e2e77..d76eea49d2 100644 --- a/core/fpdfapi/fpdf_page/pageint.h +++ b/core/fpdfapi/fpdf_page/pageint.h @@ -39,7 +39,7 @@ class CPDF_StreamParser { public: enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; - CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); + CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize); ~CPDF_StreamParser(); CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, @@ -48,14 +48,14 @@ class CPDF_StreamParser { FX_BOOL bDecode); SyntaxType ParseNextElement(); uint8_t* GetWordBuf() { return m_WordBuffer; } - FX_DWORD GetWordSize() const { return m_WordSize; } + uint32_t GetWordSize() const { return m_WordSize; } CPDF_Object* GetObject() { CPDF_Object* pObj = m_pLastObj; m_pLastObj = NULL; return pObj; } - FX_DWORD GetPos() const { return m_Pos; } - void SetPos(FX_DWORD pos) { m_Pos = pos; } + uint32_t GetPos() const { return m_Pos; } + void SetPos(uint32_t pos) { m_Pos = pos; } CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE, FX_BOOL bInArray = FALSE); void SkipPathObject(); @@ -69,13 +69,13 @@ class CPDF_StreamParser { const uint8_t* m_pBuf; // Length in bytes of m_pBuf. - FX_DWORD m_Size; + uint32_t m_Size; // Current byte position within m_pBuf. - FX_DWORD m_Pos; + uint32_t m_Pos; uint8_t m_WordBuffer[256]; - FX_DWORD m_WordSize; + uint32_t m_WordSize; CPDF_Object* m_pLastObj; private: @@ -128,14 +128,14 @@ class CPDF_StreamContentParser { void AddNameParam(const FX_CHAR* name, int size); int GetNextParamPos(); void ClearAllParams(); - CPDF_Object* GetObject(FX_DWORD index); - CFX_ByteString GetString(FX_DWORD index); - FX_FLOAT GetNumber(FX_DWORD index); - FX_FLOAT GetNumber16(FX_DWORD index); - int GetInteger(FX_DWORD index) { return (int32_t)(GetNumber(index)); } + CPDF_Object* GetObject(uint32_t index); + CFX_ByteString GetString(uint32_t index); + FX_FLOAT GetNumber(uint32_t index); + FX_FLOAT GetNumber16(uint32_t index); + int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); } void OnOperator(const FX_CHAR* op); void BigCaseCaller(int index); - FX_DWORD GetParsePos() { return m_pSyntax->GetPos(); } + uint32_t GetParsePos() { return m_pSyntax->GetPos(); } void AddTextObject(CFX_ByteString* pText, FX_FLOAT fInitKerning, FX_FLOAT* pKerning, @@ -144,7 +144,7 @@ class CPDF_StreamContentParser { void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y); void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y); void OnChangeTextMatrix(); - FX_DWORD Parse(const uint8_t* pData, FX_DWORD dwSize, FX_DWORD max_cost); + uint32_t Parse(const uint8_t* pData, uint32_t dwSize, uint32_t max_cost); void ParsePathObject(); void AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag); void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_FLOAT w, FX_FLOAT h); @@ -168,7 +168,7 @@ class CPDF_StreamContentParser { protected: using OpCodes = - std::unordered_map<FX_DWORD, void (CPDF_StreamContentParser::*)()>; + std::unordered_map<uint32_t, void (CPDF_StreamContentParser::*)()>; static OpCodes InitializeOpCodes(); void Handle_CloseFillStrokePath(); @@ -254,8 +254,8 @@ class CPDF_StreamContentParser { CFX_FloatRect m_BBox; CPDF_ParseOptions m_Options; ContentParam m_ParamBuf[PARAM_BUF_SIZE]; - FX_DWORD m_ParamStartPos; - FX_DWORD m_ParamCount; + uint32_t m_ParamStartPos; + uint32_t m_ParamCount; CPDF_StreamParser* m_pSyntax; std::unique_ptr<CPDF_AllStates> m_pCurStates; CPDF_ContentMark m_CurContentMark; @@ -313,12 +313,12 @@ class CPDF_ContentParser { FX_BOOL m_bForm; CPDF_ParseOptions m_Options; CPDF_Type3Char* m_pType3Char; - FX_DWORD m_nStreams; + uint32_t m_nStreams; std::unique_ptr<CPDF_StreamAcc> m_pSingleStream; std::vector<std::unique_ptr<CPDF_StreamAcc>> m_StreamArray; uint8_t* m_pData; - FX_DWORD m_Size; - FX_DWORD m_CurrentOffset; + uint32_t m_Size; + uint32_t m_CurrentOffset; std::unique_ptr<CPDF_StreamContentParser> m_pParser; }; @@ -361,7 +361,7 @@ class CPDF_DocPageData { using CPDF_FontFileMap = std::map<CPDF_Stream*, CPDF_CountedStreamAcc*>; using CPDF_FontMap = std::map<CPDF_Dictionary*, CPDF_CountedFont*>; using CPDF_IccProfileMap = std::map<CPDF_Stream*, CPDF_CountedIccProfile*>; - using CPDF_ImageMap = std::map<FX_DWORD, CPDF_CountedImage*>; + using CPDF_ImageMap = std::map<uint32_t, CPDF_CountedImage*>; using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>; CPDF_Document* const m_pPDFDoc; @@ -441,14 +441,14 @@ class CPDF_StitchFunc : public CPDF_Function { class CPDF_IccProfile { public: - CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); + CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize); ~CPDF_IccProfile(); - FX_DWORD GetComponents() const { return m_nSrcComponents; } + uint32_t GetComponents() const { return m_nSrcComponents; } FX_BOOL m_bsRGB; void* m_pTransform; private: - FX_DWORD m_nSrcComponents; + uint32_t m_nSrcComponents; }; class CPDF_DeviceCS : public CPDF_ColorSpace { diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index dec8fbdfaf..9cbf999702 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -40,7 +40,7 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile) { } return pDoc; } -CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size) { +CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, uint32_t size) { return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), TRUE); } @@ -53,7 +53,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) { bool bNumber; CFX_ByteString word = parser.GetNextWord(&bNumber); if (bNumber) { - FX_DWORD objnum = FXSYS_atoui(word); + uint32_t objnum = FXSYS_atoui(word); word = parser.GetNextWord(&bNumber); if (!bNumber) { break; diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp index acd39a9390..69de5bbc26 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp @@ -76,43 +76,43 @@ CFX_Matrix CPDF_Array::GetMatrix() { return matrix; } -CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const { - if (i >= (FX_DWORD)m_Objects.GetSize()) +CPDF_Object* CPDF_Array::GetElement(uint32_t i) const { + if (i >= (uint32_t)m_Objects.GetSize()) return nullptr; return m_Objects.GetAt(i); } -CPDF_Object* CPDF_Array::GetElementValue(FX_DWORD i) const { - if (i >= (FX_DWORD)m_Objects.GetSize()) +CPDF_Object* CPDF_Array::GetElementValue(uint32_t i) const { + if (i >= (uint32_t)m_Objects.GetSize()) return nullptr; return m_Objects.GetAt(i)->GetDirect(); } -CFX_ByteString CPDF_Array::GetStringAt(FX_DWORD i) const { - if (i >= (FX_DWORD)m_Objects.GetSize()) +CFX_ByteString CPDF_Array::GetStringAt(uint32_t i) const { + if (i >= (uint32_t)m_Objects.GetSize()) return CFX_ByteString(); return m_Objects.GetAt(i)->GetString(); } -CFX_ByteStringC CPDF_Array::GetConstStringAt(FX_DWORD i) const { - if (i >= (FX_DWORD)m_Objects.GetSize()) +CFX_ByteStringC CPDF_Array::GetConstStringAt(uint32_t i) const { + if (i >= (uint32_t)m_Objects.GetSize()) return CFX_ByteStringC(); return m_Objects.GetAt(i)->GetConstString(); } -int CPDF_Array::GetIntegerAt(FX_DWORD i) const { - if (i >= (FX_DWORD)m_Objects.GetSize()) +int CPDF_Array::GetIntegerAt(uint32_t i) const { + if (i >= (uint32_t)m_Objects.GetSize()) return 0; return m_Objects.GetAt(i)->GetInteger(); } -FX_FLOAT CPDF_Array::GetNumberAt(FX_DWORD i) const { - if (i >= (FX_DWORD)m_Objects.GetSize()) +FX_FLOAT CPDF_Array::GetNumberAt(uint32_t i) const { + if (i >= (uint32_t)m_Objects.GetSize()) return 0; return m_Objects.GetAt(i)->GetNumber(); } -CPDF_Dictionary* CPDF_Array::GetDictAt(FX_DWORD i) const { +CPDF_Dictionary* CPDF_Array::GetDictAt(uint32_t i) const { CPDF_Object* p = GetElementValue(i); if (!p) return NULL; @@ -123,16 +123,16 @@ CPDF_Dictionary* CPDF_Array::GetDictAt(FX_DWORD i) const { return NULL; } -CPDF_Stream* CPDF_Array::GetStreamAt(FX_DWORD i) const { +CPDF_Stream* CPDF_Array::GetStreamAt(uint32_t i) const { return ToStream(GetElementValue(i)); } -CPDF_Array* CPDF_Array::GetArrayAt(FX_DWORD i) const { +CPDF_Array* CPDF_Array::GetArrayAt(uint32_t i) const { return ToArray(GetElementValue(i)); } -void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) { - if (i >= (FX_DWORD)m_Objects.GetSize()) +void CPDF_Array::RemoveAt(uint32_t i, int nCount) { + if (i >= (uint32_t)m_Objects.GetSize()) return; if (nCount <= 0 || nCount > m_Objects.GetSize() - i) @@ -145,12 +145,12 @@ void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) { m_Objects.RemoveAt(i, nCount); } -void CPDF_Array::SetAt(FX_DWORD i, +void CPDF_Array::SetAt(uint32_t i, CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs) { ASSERT(IsArray()); - ASSERT(i < (FX_DWORD)m_Objects.GetSize()); - if (i >= (FX_DWORD)m_Objects.GetSize()) + ASSERT(i < (uint32_t)m_Objects.GetSize()); + if (i >= (uint32_t)m_Objects.GetSize()) return; if (CPDF_Object* pOld = m_Objects.GetAt(i)) pOld->Release(); @@ -161,7 +161,7 @@ void CPDF_Array::SetAt(FX_DWORD i, m_Objects.SetAt(i, pObj); } -void CPDF_Array::InsertAt(FX_DWORD index, +void CPDF_Array::InsertAt(uint32_t index, CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs) { if (pObj->GetObjNum()) { @@ -201,7 +201,7 @@ void CPDF_Array::AddNumber(FX_FLOAT f) { } void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, - FX_DWORD objnum) { + uint32_t objnum) { ASSERT(IsArray()); Add(new CPDF_Reference(pDoc, objnum)); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp index 2c41c13a5a..858133d58e 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp @@ -46,7 +46,7 @@ CPDF_DataAvail::CPDF_DataAvail(IPDF_DataAvail::FileAvail* pFileAvail, m_Pos = 0; m_dwFileLen = 0; if (m_pFileRead) { - m_dwFileLen = (FX_DWORD)m_pFileRead->GetSize(); + m_dwFileLen = (uint32_t)m_pFileRead->GetSize(); } m_dwCurrentOffset = 0; m_dwXRefOffset = 0; @@ -107,7 +107,7 @@ void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) { m_pDocument = pDoc; } -FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) { +uint32_t CPDF_DataAvail::GetObjectSize(uint32_t objnum, FX_FILESIZE& offset) { CPDF_Parser* pParser = m_pDocument->GetParser(); if (!pParser || !pParser->IsValidObjectNumber(objnum)) return 0; @@ -140,7 +140,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail( if (!obj_array.GetSize()) return TRUE; - FX_DWORD count = 0; + uint32_t count = 0; CFX_ArrayTemplate<CPDF_Object*> new_obj_array; int32_t i = 0; for (i = 0; i < obj_array.GetSize(); i++) { @@ -152,7 +152,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail( switch (type) { case CPDF_Object::ARRAY: { CPDF_Array* pArray = pObj->GetArray(); - for (FX_DWORD k = 0; k < pArray->GetCount(); ++k) + for (uint32_t k = 0; k < pArray->GetCount(); ++k) new_obj_array.Add(pArray->GetElement(k)); } break; case CPDF_Object::STREAM: @@ -171,10 +171,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail( } break; case CPDF_Object::REFERENCE: { CPDF_Reference* pRef = pObj->AsReference(); - FX_DWORD dwNum = pRef->GetRefObjNum(); + uint32_t dwNum = pRef->GetRefObjNum(); FX_FILESIZE offset; - FX_DWORD size = GetObjectSize(dwNum, offset); + uint32_t size = GetObjectSize(dwNum, offset); if (size == 0 || offset < 0 || offset >= m_dwFileLen) break; @@ -197,7 +197,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail( for (i = 0; i < iSize; ++i) { CPDF_Object* pObj = new_obj_array[i]; if (CPDF_Reference* pRef = pObj->AsReference()) { - FX_DWORD dwNum = pRef->GetRefObjNum(); + uint32_t dwNum = pRef->GetRefObjNum(); if (!pdfium::ContainsKey(m_ObjectSet, dwNum)) ret_array.Add(pObj); } else { @@ -215,7 +215,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail( IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsDocAvail( IPDF_DataAvail::DownloadHints* pHints) { if (!m_dwFileLen && m_pFileRead) { - m_dwFileLen = (FX_DWORD)m_pFileRead->GetSize(); + m_dwFileLen = (uint32_t)m_pFileRead->GetSize(); if (!m_dwFileLen) return DataError; } @@ -343,17 +343,17 @@ FX_BOOL CPDF_DataAvail::CheckPageStatus(IPDF_DataAvail::DownloadHints* pHints) { } FX_BOOL CPDF_DataAvail::LoadAllFile(IPDF_DataAvail::DownloadHints* pHints) { - if (m_pFileAvail->IsDataAvail(0, (FX_DWORD)m_dwFileLen)) { + if (m_pFileAvail->IsDataAvail(0, (uint32_t)m_dwFileLen)) { m_docStatus = PDF_DATAAVAIL_DONE; return TRUE; } - pHints->AddSegment(0, (FX_DWORD)m_dwFileLen); + pHints->AddSegment(0, (uint32_t)m_dwFileLen); return FALSE; } FX_BOOL CPDF_DataAvail::LoadAllXref(IPDF_DataAvail::DownloadHints* pHints) { - m_parser.m_pSyntax->InitParser(m_pFileRead, (FX_DWORD)m_dwHeaderOffset); + m_parser.m_pSyntax->InitParser(m_pFileRead, (uint32_t)m_dwHeaderOffset); m_parser.m_bOwnFileRead = false; if (!m_parser.LoadAllCrossRefV4(m_dwLastXRefOffset) && !m_parser.LoadAllCrossRefV5(m_dwLastXRefOffset)) { @@ -368,11 +368,11 @@ FX_BOOL CPDF_DataAvail::LoadAllXref(IPDF_DataAvail::DownloadHints* pHints) { return TRUE; } -CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, +CPDF_Object* CPDF_DataAvail::GetObject(uint32_t objnum, IPDF_DataAvail::DownloadHints* pHints, FX_BOOL* pExistInFile) { CPDF_Object* pRet = nullptr; - FX_DWORD size = 0; + uint32_t size = 0; FX_FILESIZE offset = 0; CPDF_Parser* pParser = nullptr; @@ -383,7 +383,7 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum, size = GetObjectSize(objnum, offset); pParser = m_pDocument->GetParser(); } else { - size = (FX_DWORD)m_parser.GetObjectSize(objnum); + size = (uint32_t)m_parser.GetObjectSize(objnum); offset = m_parser.GetObjectOffset(objnum); pParser = &m_parser; } @@ -498,10 +498,10 @@ void CPDF_DataAvail::ResetFirstCheck(int iPage) { } FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) { - FX_DWORD iPageObjs = m_PageObjList.GetSize(); - CFX_ArrayTemplate<FX_DWORD> UnavailObjList; - for (FX_DWORD i = 0; i < iPageObjs; ++i) { - FX_DWORD dwPageObjNum = m_PageObjList.GetAt(i); + uint32_t iPageObjs = m_PageObjList.GetSize(); + CFX_ArrayTemplate<uint32_t> UnavailObjList; + for (uint32_t i = 0; i < iPageObjs; ++i) { + uint32_t dwPageObjNum = m_PageObjList.GetAt(i); FX_BOOL bExist = FALSE; CPDF_Object* pObj = GetObject(dwPageObjNum, pHints, &bExist); if (!pObj) { @@ -540,8 +540,8 @@ FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) { return FALSE; } - FX_DWORD iPages = m_PagesArray.GetSize(); - for (FX_DWORD i = 0; i < iPages; i++) { + uint32_t iPages = m_PagesArray.GetSize(); + for (uint32_t i = 0; i < iPages; i++) { CPDF_Object* pPages = m_PagesArray.GetAt(i); if (!pPages) continue; @@ -583,7 +583,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) { break; case CPDF_Object::ARRAY: { CPDF_Array* pKidsArray = pKids->AsArray(); - for (FX_DWORD i = 0; i < pKidsArray->GetCount(); ++i) { + for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) { if (CPDF_Reference* pRef = ToReference(pKidsArray->GetElement(i))) m_PageObjList.Add(pRef->GetRefObjNum()); } @@ -623,9 +623,9 @@ FX_BOOL CPDF_DataAvail::CheckPages(IPDF_DataAvail::DownloadHints* pHints) { } FX_BOOL CPDF_DataAvail::CheckHeader(IPDF_DataAvail::DownloadHints* pHints) { - FX_DWORD req_size = 1024; + uint32_t req_size = 1024; if ((FX_FILESIZE)req_size > m_dwFileLen) - req_size = (FX_DWORD)m_dwFileLen; + req_size = (uint32_t)m_dwFileLen; if (m_pFileAvail->IsDataAvail(0, req_size)) { uint8_t buffer[1024]; @@ -667,10 +667,10 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) { FX_BOOL bNeedDownLoad = FALSE; if (pEndOffSet->IsNumber()) { - FX_DWORD dwEnd = pEndOffSet->GetInteger(); + uint32_t dwEnd = pEndOffSet->GetInteger(); dwEnd += 512; if ((FX_FILESIZE)dwEnd > m_dwFileLen) - dwEnd = (FX_DWORD)m_dwFileLen; + dwEnd = (uint32_t)m_dwFileLen; int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen); int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0; @@ -689,9 +689,9 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) { dwFileLen = pFileLen->GetInteger(); if (!m_pFileAvail->IsDataAvail(m_dwLastXRefOffset, - (FX_DWORD)(dwFileLen - m_dwLastXRefOffset))) { + (uint32_t)(dwFileLen - m_dwLastXRefOffset))) { if (m_docStatus == PDF_DATAAVAIL_FIRSTPAGE) { - FX_DWORD dwSize = (FX_DWORD)(dwFileLen - m_dwLastXRefOffset); + uint32_t dwSize = (uint32_t)(dwFileLen - m_dwLastXRefOffset); FX_FILESIZE offset = m_dwLastXRefOffset; if (dwSize < 512 && dwFileLen > 512) { dwSize = 512; @@ -714,12 +714,12 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) { } FX_BOOL CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset, - FX_DWORD size, + uint32_t size, IPDF_DataAvail::DownloadHints* pHints) { if (offset > m_dwFileLen) return TRUE; - FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<FX_DWORD>(offset); + FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<uint32_t>(offset); safeSize += size; safeSize += 512; if (!safeSize.IsValid() || safeSize.ValueOrDie() > m_dwFileLen) @@ -785,7 +785,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IPDF_DataAvail::DownloadHints* pHints) { CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt( FX_FILESIZE pos, - FX_DWORD objnum, + uint32_t objnum, CPDF_IndirectObjectHolder* pObjList) { FX_FILESIZE SavedPos = m_syntaxParser.SavePos(); m_syntaxParser.RestorePos(pos); @@ -795,7 +795,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt( if (!bIsNumber) return nullptr; - FX_DWORD parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word); if (objnum && parser_objnum != objnum) return nullptr; @@ -803,7 +803,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt( if (!bIsNumber) return nullptr; - FX_DWORD gennum = FXSYS_atoui(word); + uint32_t gennum = FXSYS_atoui(word); if (m_syntaxParser.GetKeyword() != "obj") { m_syntaxParser.RestorePos(SavedPos); return nullptr; @@ -816,7 +816,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt( } IPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() { - FX_DWORD req_size = 1024; + uint32_t req_size = 1024; if (!m_pFileAvail->IsDataAvail(0, req_size)) return LinearizationUnknown; @@ -834,7 +834,7 @@ IPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() { return NotLinearized; } -FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) { +FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE)); int32_t offset = GetHeaderOffset(file.get()); @@ -852,7 +852,7 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) { if (!bNumber) return FALSE; - FX_DWORD objnum = FXSYS_atoui(wordObjNum); + uint32_t objnum = FXSYS_atoui(wordObjNum); if (m_pLinearized) { m_pLinearized->Release(); m_pLinearized = nullptr; @@ -883,8 +883,8 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) { } FX_BOOL CPDF_DataAvail::CheckEnd(IPDF_DataAvail::DownloadHints* pHints) { - FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0); - FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos); + uint32_t req_pos = (uint32_t)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0); + uint32_t dwSize = (uint32_t)(m_dwFileLen - req_pos); if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) { uint8_t buffer[1024]; @@ -928,8 +928,8 @@ int32_t CPDF_DataAvail::CheckCrossRefStream( IPDF_DataAvail::DownloadHints* pHints, FX_FILESIZE& xref_offset) { xref_offset = 0; - FX_DWORD req_size = - (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); + uint32_t req_size = + (uint32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512); if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) { int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam); @@ -946,7 +946,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream( if (!bNumber) return -1; - FX_DWORD objNum = FXSYS_atoui(objnum); + uint32_t objNum = FXSYS_atoui(objnum); CPDF_Object* pObj = m_parser.ParseIndirectObjectAt(nullptr, 0, objNum); if (!pObj) { m_Pos += m_parser.m_pSyntax->SavePos(); @@ -997,7 +997,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) { } uint8_t buffer[256]; - FX_DWORD index = 0; + uint32_t index = 0; if (PDFCharIsDelimiter(ch)) { buffer[index++] = ch; if (ch == '/') { @@ -1063,9 +1063,9 @@ FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t& ch) { if (m_bufferOffset >= pos || (FX_FILESIZE)(m_bufferOffset + m_bufferSize) <= pos) { FX_FILESIZE read_pos = pos; - FX_DWORD read_size = 512; + uint32_t read_size = 512; if ((FX_FILESIZE)read_size > m_dwFileLen) - read_size = (FX_DWORD)m_dwFileLen; + read_size = (uint32_t)m_dwFileLen; if ((FX_FILESIZE)(read_pos + read_size) > m_dwFileLen) read_pos = m_dwFileLen - read_size; @@ -1210,7 +1210,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IPDF_DataAvail::DownloadHints* pHints) { return TRUE; } - FX_DWORD xrefpos = GetDirectInteger(pTrailerDict, "Prev"); + uint32_t xrefpos = GetDirectInteger(pTrailerDict, "Prev"); if (xrefpos) { m_dwPrevXRefOffset = GetDirectInteger(pTrailerDict, "XRefStm"); if (m_dwPrevXRefOffset) { @@ -1259,7 +1259,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, } FX_BOOL CPDF_DataAvail::CheckArrayPageNode( - FX_DWORD dwPageNo, + uint32_t dwPageNo, CPDF_DataAvail::PageNode* pPageNode, IPDF_DataAvail::DownloadHints* pHints) { FX_BOOL bExist = FALSE; @@ -1285,7 +1285,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode( } pPageNode->m_type = PDF_PAGENODE_PAGES; - for (FX_DWORD i = 0; i < pArray->GetCount(); ++i) { + for (uint32_t i = 0; i < pArray->GetCount(); ++i) { CPDF_Reference* pKid = ToReference(pArray->GetElement(i)); if (!pKid) continue; @@ -1299,7 +1299,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode( } FX_BOOL CPDF_DataAvail::CheckUnkownPageNode( - FX_DWORD dwPageNo, + uint32_t dwPageNo, CPDF_DataAvail::PageNode* pPageNode, IPDF_DataAvail::DownloadHints* pHints) { FX_BOOL bExist = FALSE; @@ -1348,7 +1348,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode( } break; case CPDF_Object::ARRAY: { CPDF_Array* pKidsArray = pKids->AsArray(); - for (FX_DWORD i = 0; i < pKidsArray->GetCount(); ++i) { + for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) { CPDF_Reference* pKid = ToReference(pKidsArray->GetElement(i)); if (!pKid) continue; @@ -1623,7 +1623,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail( return DataAvailable; if (m_bLinearized) { - if ((FX_DWORD)iPage == m_dwFirstPageNo) { + if ((uint32_t)iPage == m_dwFirstPageNo) { DocAvailStatus nRet = CheckLinearizedFirstPage(iPage, pHints); if (nRet == DataAvailable) m_pagesLoadState.insert(iPage); @@ -1753,11 +1753,11 @@ FX_BOOL CPDF_DataAvail::CheckResources(IPDF_DataAvail::DownloadHints* pHints) { } void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, - FX_DWORD* pSize) { + uint32_t* pSize) { if (pPos) *pPos = m_dwLastXRefOffset; if (pSize) - *pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset); + *pSize = (uint32_t)(m_dwFileLen - m_dwLastXRefOffset); } int CPDF_DataAvail::GetPageCount() const { @@ -1781,13 +1781,13 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) { if (m_pHintTables && index != pageNum) { FX_FILESIZE szPageStartPos = 0; FX_FILESIZE szPageLength = 0; - FX_DWORD dwObjNum = 0; + uint32_t dwObjNum = 0; FX_BOOL bPagePosGot = m_pHintTables->GetPagePos(index, szPageStartPos, szPageLength, dwObjNum); if (!bPagePosGot) return nullptr; - m_syntaxParser.InitParser(m_pFileRead, (FX_DWORD)szPageStartPos); + m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos); CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument); if (!pPageDict) return nullptr; diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h index 036de72968..f7da8f0d22 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h @@ -63,7 +63,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { DocFormStatus IsFormAvail(DownloadHints* pHints) override; DocLinearizationStatus IsLinearizedPDF() override; FX_BOOL IsLinearized() override { return m_bLinearized; } - void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, FX_DWORD* pSize) override; + void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize) override; int GetPageCount() const; CPDF_Dictionary* GetPage(int index); @@ -77,7 +77,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { ~PageNode(); PDF_PAGENODE_TYPE m_type; - FX_DWORD m_dwPageNo; + uint32_t m_dwPageNo; CFX_ArrayTemplate<PageNode*> m_childNode; }; @@ -85,7 +85,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { static int s_CurrentDataAvailRecursionDepth; static const int kMaxPageRecursionDepth = 1024; - FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset); + uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset); FX_BOOL IsObjectsAvail(CFX_ArrayTemplate<CPDF_Object*>& obj_array, FX_BOOL bParsePage, IPDF_DataAvail::DownloadHints* pHints, @@ -112,15 +112,15 @@ class CPDF_DataAvail final : public IPDF_DataAvail { int32_t CheckCrossRefStream(IPDF_DataAvail::DownloadHints* pHints, FX_FILESIZE& xref_offset); - FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen); + FX_BOOL IsLinearizedFile(uint8_t* pData, uint32_t dwLen); void SetStartOffset(FX_FILESIZE dwOffset); FX_BOOL GetNextToken(CFX_ByteString& token); FX_BOOL GetNextChar(uint8_t& ch); CPDF_Object* ParseIndirectObjectAt( FX_FILESIZE pos, - FX_DWORD objnum, + uint32_t objnum, CPDF_IndirectObjectHolder* pObjList = nullptr); - CPDF_Object* GetObject(FX_DWORD objnum, + CPDF_Object* GetObject(uint32_t objnum, IPDF_DataAvail::DownloadHints* pHints, FX_BOOL* pExistInFile); FX_BOOL GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages); @@ -143,24 +143,24 @@ class CPDF_DataAvail final : public IPDF_DataAvail { int32_t& iCount, IPDF_DataAvail::DownloadHints* pHints, int level); - FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo, + FX_BOOL CheckUnkownPageNode(uint32_t dwPageNo, PageNode* pPageNode, IPDF_DataAvail::DownloadHints* pHints); - FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo, + FX_BOOL CheckArrayPageNode(uint32_t dwPageNo, PageNode* pPageNode, IPDF_DataAvail::DownloadHints* pHints); FX_BOOL CheckPageCount(IPDF_DataAvail::DownloadHints* pHints); bool IsFirstCheck(int iPage); void ResetFirstCheck(int iPage); FX_BOOL IsDataAvail(FX_FILESIZE offset, - FX_DWORD size, + uint32_t size, IPDF_DataAvail::DownloadHints* pHints); CPDF_Parser m_parser; CPDF_SyntaxParser m_syntaxParser; CPDF_Object* m_pRoot; - FX_DWORD m_dwRootObjNum; - FX_DWORD m_dwInfoObjNum; + uint32_t m_dwRootObjNum; + uint32_t m_dwInfoObjNum; CPDF_Object* m_pLinearized; CPDF_Object* m_pTrailer; FX_BOOL m_bDocAvail; @@ -172,18 +172,18 @@ class CPDF_DataAvail final : public IPDF_DataAvail { PDF_DATAAVAIL_STATUS m_docStatus; FX_FILESIZE m_dwFileLen; CPDF_Document* m_pDocument; - std::set<FX_DWORD> m_ObjectSet; + std::set<uint32_t> m_ObjectSet; CFX_ArrayTemplate<CPDF_Object*> m_objs_array; FX_FILESIZE m_Pos; FX_FILESIZE m_bufferOffset; - FX_DWORD m_bufferSize; + uint32_t m_bufferSize; CFX_ByteString m_WordBuf; uint8_t m_bufferData[512]; - CFX_ArrayTemplate<FX_DWORD> m_XRefStreamList; - CFX_ArrayTemplate<FX_DWORD> m_PageObjList; - FX_DWORD m_PagesObjNum; + CFX_ArrayTemplate<uint32_t> m_XRefStreamList; + CFX_ArrayTemplate<uint32_t> m_PageObjList; + uint32_t m_PagesObjNum; FX_BOOL m_bLinearized; - FX_DWORD m_dwFirstPageNo; + uint32_t m_dwFirstPageNo; FX_BOOL m_bLinearedDataOK; FX_BOOL m_bMainXRefLoadTried; FX_BOOL m_bMainXRefLoadedOK; @@ -193,7 +193,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail { FX_FILESIZE m_dwCurrentXRefSteam; FX_BOOL m_bAnnotsLoad; FX_BOOL m_bHaveAcroForm; - FX_DWORD m_dwAcroFormObjNum; + uint32_t m_dwAcroFormObjNum; FX_BOOL m_bAcroFormLoad; CPDF_Object* m_pAcroForm; CFX_ArrayTemplate<CPDF_Object*> m_arrayAcroforms; @@ -203,13 +203,13 @@ class CPDF_DataAvail final : public IPDF_DataAvail { FX_BOOL m_bPageLoadedOK; FX_BOOL m_bLinearizedFormParamLoad; CFX_ArrayTemplate<CPDF_Object*> m_PagesArray; - FX_DWORD m_dwEncryptObjNum; + uint32_t m_dwEncryptObjNum; FX_FILESIZE m_dwPrevXRefOffset; FX_BOOL m_bTotalLoadPageTree; FX_BOOL m_bCurPageDictLoadOK; PageNode m_pageNodes; - std::set<FX_DWORD> m_pageMapCheckState; - std::set<FX_DWORD> m_pagesLoadState; + std::set<uint32_t> m_pageMapCheckState; + std::set<uint32_t> m_pagesLoadState; std::unique_ptr<CPDF_HintTables> m_pHintTables; FX_BOOL m_bSupportHintTable; }; diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp index 0155c43bb8..75730e5754 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp @@ -229,13 +229,13 @@ void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key, void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectObjectHolder* pDoc, - FX_DWORD objnum) { + uint32_t objnum) { SetAt(key, new CPDF_Reference(pDoc, objnum)); } void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key, CPDF_IndirectObjectHolder* pDoc, - FX_DWORD objnum) { + uint32_t objnum) { SetAt(key, new CPDF_Reference(pDoc, objnum)); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index eb9a483e6e..9ed8b3fac6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -32,7 +32,7 @@ int CountPages(CPDF_Dictionary* pPages, return 0; } count = 0; - for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { + for (uint32_t i = 0; i < pKidList->GetCount(); i++) { CPDF_Dictionary* pKid = pKidList->GetDictAt(i); if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) { continue; @@ -114,7 +114,7 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { m_ID1 = pIDArray->GetStringAt(0); m_ID2 = pIDArray->GetStringAt(1); } - FX_DWORD dwPageCount = 0; + uint32_t dwPageCount = 0; CPDF_Object* pCount = pLinearized->GetElement("N"); if (ToNumber(pCount)) dwPageCount = pCount->GetInteger(); @@ -216,8 +216,8 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { } int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, - FX_DWORD& skip_count, - FX_DWORD objnum, + uint32_t& skip_count, + uint32_t objnum, int& index, int level) { if (pNode->KeyExist("Kids")) { @@ -228,14 +228,14 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, if (level >= FX_MAX_PAGE_LEVEL) { return -1; } - FX_DWORD count = pNode->GetIntegerBy("Count"); + uint32_t count = pNode->GetIntegerBy("Count"); if (count <= skip_count) { skip_count -= count; index += count; return -1; } if (count && count == pKidList->GetCount()) { - for (FX_DWORD i = 0; i < count; i++) { + for (uint32_t i = 0; i < count; i++) { if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) { if (pKid->GetRefObjNum() == objnum) { m_PageList.SetAt(index + i, objnum); @@ -244,7 +244,7 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, } } } - for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { + for (uint32_t i = 0; i < pKidList->GetCount(); i++) { CPDF_Dictionary* pKid = pKidList->GetDictAt(i); if (!pKid) { continue; @@ -269,12 +269,12 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, } return -1; } -int CPDF_Document::GetPageIndex(FX_DWORD objnum) { - FX_DWORD nPages = m_PageList.GetSize(); - FX_DWORD skip_count = 0; +int CPDF_Document::GetPageIndex(uint32_t objnum) { + uint32_t nPages = m_PageList.GetSize(); + uint32_t skip_count = 0; FX_BOOL bSkipped = FALSE; - for (FX_DWORD i = 0; i < nPages; i++) { - FX_DWORD objnum1 = m_PageList.GetAt(i); + for (uint32_t i = 0; i < nPages; i++) { + uint32_t objnum1 = m_PageList.GetAt(i); if (objnum1 == objnum) { return i; } @@ -315,14 +315,14 @@ int CPDF_Document::RetrievePageCount() const { return CountPages(pPages, &visited_pages); } -FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { +uint32_t CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { if (!m_pParser) { - return (FX_DWORD)-1; + return (uint32_t)-1; } return m_pParser->GetPermissions(bCheckRevision); } -FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { +FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const { auto it = m_IndirectObjs.find(objnum); if (it != m_IndirectObjs.end()) { CPDF_Stream* pStream = it->second->AsStream(); diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp index eafda43965..dd2be01311 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp @@ -30,7 +30,7 @@ CPDF_HintTables::~CPDF_HintTables() { m_dwIdentifierArray.RemoveAll(); } -FX_DWORD CPDF_HintTables::GetItemLength( +uint32_t CPDF_HintTables::GetItemLength( int index, const std::vector<FX_FILESIZE>& szArray) { if (index < 0 || szArray.size() < 2 || @@ -50,17 +50,17 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { if (nStreamOffset < 0 || nStreamLen < 1) return FALSE; - const FX_DWORD kHeaderSize = 288; + const uint32_t kHeaderSize = 288; if (hStream->BitsRemaining() < kHeaderSize) return FALSE; // Item 1: The least number of objects in a page. - FX_DWORD dwObjLeastNum = hStream->GetBits(32); + uint32_t dwObjLeastNum = hStream->GetBits(32); // Item 2: The location of the first page's page object. - FX_DWORD dwFirstObjLoc = hStream->GetBits(32); + uint32_t dwFirstObjLoc = hStream->GetBits(32); if (dwFirstObjLoc > nStreamOffset) { - FX_SAFE_DWORD safeLoc = pdfium::base::checked_cast<FX_DWORD>(nStreamLen); + FX_SAFE_DWORD safeLoc = pdfium::base::checked_cast<uint32_t>(nStreamLen); safeLoc += dwFirstObjLoc; if (!safeLoc.IsValid()) return FALSE; @@ -73,31 +73,31 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { // Item 3: The number of bits needed to represent the difference // between the greatest and least number of objects in a page. - FX_DWORD dwDeltaObjectsBits = hStream->GetBits(16); + uint32_t dwDeltaObjectsBits = hStream->GetBits(16); // Item 4: The least length of a page in bytes. - FX_DWORD dwPageLeastLen = hStream->GetBits(32); + uint32_t dwPageLeastLen = hStream->GetBits(32); // Item 5: The number of bits needed to represent the difference // between the greatest and least length of a page, in bytes. - FX_DWORD dwDeltaPageLenBits = hStream->GetBits(16); + uint32_t dwDeltaPageLenBits = hStream->GetBits(16); // Skip Item 6, 7, 8, 9 total 96 bits. hStream->SkipBits(96); // Item 10: The number of bits needed to represent the greatest // number of shared object references. - FX_DWORD dwSharedObjBits = hStream->GetBits(16); + uint32_t dwSharedObjBits = hStream->GetBits(16); // Item 11: The number of bits needed to represent the numerically // greatest shared object identifier used by the pages. - FX_DWORD dwSharedIdBits = hStream->GetBits(16); + uint32_t dwSharedIdBits = hStream->GetBits(16); // Item 12: The number of bits needed to represent the numerator of // the fractional position for each shared object reference. For each // shared object referenced from a page, there is an indication of // where in the page's content stream the object is first referenced. - FX_DWORD dwSharedNumeratorBits = hStream->GetBits(16); + uint32_t dwSharedNumeratorBits = hStream->GetBits(16); // Item 13: Skip Item 13 which has 16 bits. hStream->SkipBits(16); @@ -108,7 +108,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { return FALSE; FX_SAFE_DWORD required_bits = dwDeltaObjectsBits; - required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages); + required_bits *= pdfium::base::checked_cast<uint32_t>(nPages); if (!CanReadFromBitStream(hStream, required_bits)) return FALSE; @@ -122,11 +122,11 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { hStream->ByteAlign(); required_bits = dwDeltaPageLenBits; - required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages); + required_bits *= pdfium::base::checked_cast<uint32_t>(nPages); if (!CanReadFromBitStream(hStream, required_bits)) return FALSE; - CFX_ArrayTemplate<FX_DWORD> dwPageLenArray; + CFX_ArrayTemplate<uint32_t> dwPageLenArray; for (int i = 0; i < nPages; ++i) { FX_SAFE_DWORD safePageLen = hStream->GetBits(dwDeltaPageLenBits); safePageLen += dwPageLeastLen; @@ -170,7 +170,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { // Number of shared objects. required_bits = dwSharedObjBits; - required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages); + required_bits *= pdfium::base::checked_cast<uint32_t>(nPages); if (!CanReadFromBitStream(hStream, required_bits)) return FALSE; @@ -200,7 +200,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { } hStream->ByteAlign(); - FX_SAFE_DWORD safeTotalPageLen = pdfium::base::checked_cast<FX_DWORD>(nPages); + FX_SAFE_DWORD safeTotalPageLen = pdfium::base::checked_cast<uint32_t>(nPages); safeTotalPageLen *= dwDeltaPageLenBits; if (!CanReadFromBitStream(hStream, safeTotalPageLen)) return FALSE; @@ -211,7 +211,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) { } FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream, - FX_DWORD offset) { + uint32_t offset) { if (!hStream || hStream->IsEOF()) return FALSE; @@ -226,16 +226,16 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream, return FALSE; hStream->SkipBits(bit_offset.ValueOrDie() - hStream->GetPos()); - const FX_DWORD kHeaderSize = 192; + const uint32_t kHeaderSize = 192; if (hStream->BitsRemaining() < kHeaderSize) return FALSE; // Item 1: The object number of the first object in the shared objects // section. - FX_DWORD dwFirstSharedObjNum = hStream->GetBits(32); + uint32_t dwFirstSharedObjNum = hStream->GetBits(32); // Item 2: The location of the first object in the shared objects section. - FX_DWORD dwFirstSharedObjLoc = hStream->GetBits(32); + uint32_t dwFirstSharedObjLoc = hStream->GetBits(32); if (dwFirstSharedObjLoc > nStreamOffset) dwFirstSharedObjLoc += nStreamLen; @@ -244,31 +244,31 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream, // Item 4: The number of shared object entries for the shared objects // section, including the number of shared object entries for the first page. - FX_DWORD dwSharedObjTotal = hStream->GetBits(32); + uint32_t dwSharedObjTotal = hStream->GetBits(32); // Item 5: The number of bits needed to represent the greatest number of // objects in a shared object group. Skipped. hStream->SkipBits(16); // Item 6: The least length of a shared object group in bytes. - FX_DWORD dwGroupLeastLen = hStream->GetBits(32); + uint32_t dwGroupLeastLen = hStream->GetBits(32); // Item 7: The number of bits needed to represent the difference between the // greatest and least length of a shared object group, in bytes. - FX_DWORD dwDeltaGroupLen = hStream->GetBits(16); + uint32_t dwDeltaGroupLen = hStream->GetBits(16); CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O"); int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1; if (nFirstPageObjNum < 0) return FALSE; - FX_DWORD dwPrevObjLen = 0; - FX_DWORD dwCurObjLen = 0; + uint32_t dwPrevObjLen = 0; + uint32_t dwCurObjLen = 0; FX_SAFE_DWORD required_bits = dwSharedObjTotal; required_bits *= dwDeltaGroupLen; if (!CanReadFromBitStream(hStream, required_bits)) return FALSE; - for (FX_DWORD i = 0; i < dwSharedObjTotal; ++i) { + for (uint32_t i = 0; i < dwSharedObjTotal; ++i) { dwPrevObjLen = dwCurObjLen; FX_SAFE_DWORD safeObjLen = hStream->GetBits(dwDeltaGroupLen); safeObjLen += dwGroupLeastLen; @@ -324,7 +324,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream, FX_BOOL CPDF_HintTables::GetPagePos(int index, FX_FILESIZE& szPageStartPos, FX_FILESIZE& szPageLength, - FX_DWORD& dwObjNum) { + uint32_t& dwObjNum) { if (!m_pLinearizedDict) return FALSE; @@ -365,7 +365,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage( if (index == nFirstAvailPage) return IPDF_DataAvail::DataAvailable; - FX_DWORD dwLength = GetItemLength(index, m_szPageOffsetArray); + uint32_t dwLength = GetItemLength(index, m_szPageOffsetArray); // If two pages have the same offset, it should be treated as an error. if (!dwLength) return IPDF_DataAvail::DataError; @@ -374,7 +374,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage( return IPDF_DataAvail::DataNotAvailable; // Download data of shared objects in the page. - FX_DWORD offset = 0; + uint32_t offset = 0; for (int i = 0; i < index; ++i) offset += m_dwNSharedObjsArray[i]; @@ -383,8 +383,8 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage( if (nFirstPageObjNum < 0) return IPDF_DataAvail::DataError; - FX_DWORD dwIndex = 0; - FX_DWORD dwObjNum = 0; + uint32_t dwIndex = 0; + uint32_t dwObjNum = 0; for (int j = 0; j < m_dwNSharedObjsArray[index]; ++j) { dwIndex = m_dwIdentifierArray[offset + j]; if (dwIndex >= m_dwSharedObjNumArray.GetSize()) @@ -422,11 +422,11 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) { CPDF_StreamAcc acc; acc.LoadAllData(pHintStream); - FX_DWORD size = acc.GetSize(); + uint32_t size = acc.GetSize(); // The header section of page offset hint table is 36 bytes. // The header section of shared object hint table is 24 bytes. // Hint table has at least 60 bytes. - const FX_DWORD MIN_STREAM_LEN = 60; + const uint32_t MIN_STREAM_LEN = 60; if (size < MIN_STREAM_LEN || shared_hint_table_offset <= 0 || size < shared_hint_table_offset) { return FALSE; @@ -435,7 +435,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) { CFX_BitStream bs; bs.Init(acc.GetData(), size); return ReadPageHintTable(&bs) && - ReadSharedObjHintTable(&bs, pdfium::base::checked_cast<FX_DWORD>( + ReadSharedObjHintTable(&bs, pdfium::base::checked_cast<uint32_t>( shared_hint_table_offset)); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h index f6f862fab6..28ccccb6fc 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h @@ -30,7 +30,7 @@ class CPDF_HintTables { FX_BOOL GetPagePos(int index, FX_FILESIZE& szPageStartPos, FX_FILESIZE& szPageLength, - FX_DWORD& dwObjNum); + uint32_t& dwObjNum); IPDF_DataAvail::DocAvailStatus CheckPage( int index, @@ -40,8 +40,8 @@ class CPDF_HintTables { protected: FX_BOOL ReadPageHintTable(CFX_BitStream* hStream); - FX_BOOL ReadSharedObjHintTable(CFX_BitStream* hStream, FX_DWORD offset); - FX_DWORD GetItemLength(int index, const std::vector<FX_FILESIZE>& szArray); + FX_BOOL ReadSharedObjHintTable(CFX_BitStream* hStream, uint32_t offset); + uint32_t GetItemLength(int index, const std::vector<FX_FILESIZE>& szArray); private: int ReadPrimaryHintStreamOffset() const; @@ -49,12 +49,12 @@ class CPDF_HintTables { CPDF_Dictionary* m_pLinearizedDict; CPDF_DataAvail* m_pDataAvail; - FX_DWORD m_nFirstPageSharedObjs; + uint32_t m_nFirstPageSharedObjs; FX_FILESIZE m_szFirstPageObjOffset; - CFX_ArrayTemplate<FX_DWORD> m_dwDeltaNObjsArray; - CFX_ArrayTemplate<FX_DWORD> m_dwNSharedObjsArray; - CFX_ArrayTemplate<FX_DWORD> m_dwSharedObjNumArray; - CFX_ArrayTemplate<FX_DWORD> m_dwIdentifierArray; + CFX_ArrayTemplate<uint32_t> m_dwDeltaNObjsArray; + CFX_ArrayTemplate<uint32_t> m_dwNSharedObjsArray; + CFX_ArrayTemplate<uint32_t> m_dwSharedObjNumArray; + CFX_ArrayTemplate<uint32_t> m_dwIdentifierArray; std::vector<FX_FILESIZE> m_szPageOffsetArray; std::vector<FX_FILESIZE> m_szSharedObjOffsetArray; }; diff --git a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp index 1de1ef2252..14410dabb5 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp @@ -20,7 +20,7 @@ CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() { pair.second->Destroy(); } -CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(FX_DWORD objnum) { +CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(uint32_t objnum) { if (objnum == 0) return nullptr; @@ -44,7 +44,7 @@ CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(FX_DWORD objnum) { return pObj; } -FX_DWORD CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) { +uint32_t CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) { if (pObj->m_ObjNum) return pObj->m_ObjNum; @@ -54,7 +54,7 @@ FX_DWORD CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) { return m_LastObjNum; } -void CPDF_IndirectObjectHolder::ReleaseIndirectObject(FX_DWORD objnum) { +void CPDF_IndirectObjectHolder::ReleaseIndirectObject(uint32_t objnum) { auto it = m_IndirectObjs.find(objnum); if (it == m_IndirectObjs.end() || it->second->GetObjNum() == -1) return; @@ -62,7 +62,7 @@ void CPDF_IndirectObjectHolder::ReleaseIndirectObject(FX_DWORD objnum) { m_IndirectObjs.erase(it); } -FX_BOOL CPDF_IndirectObjectHolder::InsertIndirectObject(FX_DWORD objnum, +FX_BOOL CPDF_IndirectObjectHolder::InsertIndirectObject(uint32_t objnum, CPDF_Object* pObj) { if (!objnum || !pObj) return FALSE; diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index 5312e62d43..bebd3d62be 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -31,10 +31,10 @@ const int32_t kMaxXRefSize = 1048576; // A limit on the maximum object number in the xref table. Theoretical limits // are higher, but this may be large enough in practice. -const FX_DWORD kMaxObjectNumber = 1048576; +const uint32_t kMaxObjectNumber = 1048576; -FX_DWORD GetVarInt(const uint8_t* p, int32_t n) { - FX_DWORD result = 0; +uint32_t GetVarInt(const uint8_t* p, int32_t n) { + uint32_t result = 0; for (int32_t i = 0; i < n; ++i) result = result * 256 + p[i]; return result; @@ -67,32 +67,32 @@ CPDF_Parser::~CPDF_Parser() { CloseParser(); } -FX_DWORD CPDF_Parser::GetLastObjNum() const { +uint32_t CPDF_Parser::GetLastObjNum() const { return m_ObjectInfo.empty() ? 0 : m_ObjectInfo.rbegin()->first; } -bool CPDF_Parser::IsValidObjectNumber(FX_DWORD objnum) const { +bool CPDF_Parser::IsValidObjectNumber(uint32_t objnum) const { return !m_ObjectInfo.empty() && objnum <= m_ObjectInfo.rbegin()->first; } -FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero(FX_DWORD objnum) const { +FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero(uint32_t objnum) const { auto it = m_ObjectInfo.find(objnum); return it != m_ObjectInfo.end() ? it->second.pos : 0; } -uint8_t CPDF_Parser::GetObjectType(FX_DWORD objnum) const { +uint8_t CPDF_Parser::GetObjectType(uint32_t objnum) const { ASSERT(IsValidObjectNumber(objnum)); auto it = m_ObjectInfo.find(objnum); return it != m_ObjectInfo.end() ? it->second.type : 0; } -uint16_t CPDF_Parser::GetObjectGenNum(FX_DWORD objnum) const { +uint16_t CPDF_Parser::GetObjectGenNum(uint32_t objnum) const { ASSERT(IsValidObjectNumber(objnum)); auto it = m_ObjectInfo.find(objnum); return it != m_ObjectInfo.end() ? it->second.gennum : 0; } -bool CPDF_Parser::IsObjectFreeOrNull(FX_DWORD objnum) const { +bool CPDF_Parser::IsObjectFreeOrNull(uint32_t objnum) const { uint8_t type = GetObjectType(objnum); return type == 0 || type == 255; } @@ -109,7 +109,7 @@ IFX_FileRead* CPDF_Parser::GetFileAccess() const { return m_pSyntax->m_pFileAccess; } -void CPDF_Parser::ShrinkObjectMap(FX_DWORD objnum) { +void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) { if (objnum == 0) { m_ObjectInfo.clear(); return; @@ -302,7 +302,7 @@ void CPDF_Parser::ReleaseEncryptHandler() { m_pSecurityHandler.reset(); } -FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) const { +FX_FILESIZE CPDF_Parser::GetObjectOffset(uint32_t objnum) const { if (!IsValidObjectNumber(objnum)) return 0; @@ -371,7 +371,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) { } FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, - FX_DWORD dwObjCount) { + uint32_t dwObjCount) { if (!LoadLinearizedCrossRefV4(xrefpos, dwObjCount)) return FALSE; @@ -424,14 +424,14 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, } FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, - FX_DWORD dwObjCount) { + uint32_t dwObjCount) { FX_FILESIZE dwStartPos = pos - m_pSyntax->m_HeaderOffset; m_pSyntax->RestorePos(dwStartPos); m_SortedOffset.insert(pos); - FX_DWORD start_objnum = 0; - FX_DWORD count = dwObjCount; + uint32_t start_objnum = 0; + uint32_t count = dwObjCount; FX_FILESIZE SavedPos = m_pSyntax->SavePos(); const int32_t recordsize = 20; @@ -441,7 +441,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, int32_t nBlocks = count / 1024 + 1; for (int32_t block = 0; block < nBlocks; block++) { int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024; - FX_DWORD dwReadSize = block_size * recordsize; + uint32_t dwReadSize = block_size * recordsize; if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_pSyntax->m_FileLen) return FALSE; @@ -451,7 +451,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, } for (int32_t i = 0; i < block_size; i++) { - FX_DWORD objnum = start_objnum + block * 1024 + i; + uint32_t objnum = start_objnum + block * 1024 + i; char* pEntry = &buf[i * recordsize]; if (pEntry[17] == 'f') { m_ObjectInfo[objnum].pos = 0; @@ -505,11 +505,11 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, break; } - FX_DWORD start_objnum = FXSYS_atoui(word); + uint32_t start_objnum = FXSYS_atoui(word); if (start_objnum >= kMaxObjectNumber) return false; - FX_DWORD count = m_pSyntax->GetDirectNum(); + uint32_t count = m_pSyntax->GetDirectNum(); m_pSyntax->ToNextWord(); SavedPos = m_pSyntax->SavePos(); const int32_t recordsize = 20; @@ -526,7 +526,7 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, block_size * recordsize); for (int32_t i = 0; i < block_size; i++) { - FX_DWORD objnum = start_objnum + block * 1024 + i; + uint32_t objnum = start_objnum + block * 1024 + i; char* pEntry = &buf[i * recordsize]; if (pEntry[17] == 'f') { m_ObjectInfo[objnum].pos = 0; @@ -589,11 +589,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { ParserState state = ParserState::kDefault; int32_t inside_index = 0; - FX_DWORD objnum = 0; - FX_DWORD gennum = 0; + uint32_t objnum = 0; + uint32_t gennum = 0; int32_t depth = 0; - const FX_DWORD kBufferSize = 4096; + const uint32_t kBufferSize = 4096; std::vector<uint8_t> buffer(kBufferSize); FX_FILESIZE pos = m_pSyntax->m_HeaderOffset; @@ -606,12 +606,12 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { while (pos < m_pSyntax->m_FileLen) { const FX_FILESIZE saved_pos = pos; bool bOverFlow = false; - FX_DWORD size = - std::min((FX_DWORD)(m_pSyntax->m_FileLen - pos), kBufferSize); + uint32_t size = + std::min((uint32_t)(m_pSyntax->m_FileLen - pos), kBufferSize); if (!m_pSyntax->m_pFileAccess->ReadBlock(buffer.data(), pos, size)) break; - for (FX_DWORD i = 0; i < size; i++) { + for (uint32_t i = 0; i < size; i++) { uint8_t byte = buffer[i]; switch (state) { case ParserState::kDefault: @@ -763,17 +763,17 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { offset += 3; FX_FILESIZE nLen = obj_end - obj_pos - offset; - if ((FX_DWORD)nLen > size - i) { + if ((uint32_t)nLen > size - i) { pos = obj_end + m_pSyntax->m_HeaderOffset; bOverFlow = true; } else { - i += (FX_DWORD)nLen; + i += (uint32_t)nLen; } if (!m_ObjectInfo.empty() && IsValidObjectNumber(objnum) && m_ObjectInfo[objnum].pos) { if (pObject) { - FX_DWORD oldgen = GetObjectGenNum(objnum); + uint32_t oldgen = GetObjectGenNum(objnum); m_ObjectInfo[objnum].pos = obj_pos; m_ObjectInfo[objnum].gennum = gennum; if (oldgen != gennum) @@ -819,7 +819,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { const CFX_ByteString& key = it->first; CPDF_Object* pElement = it->second; ++it; - FX_DWORD dwObjNum = + uint32_t dwObjNum = pElement ? pElement->GetObjNum() : 0; if (dwObjNum) { m_pTrailer->SetAtReference(key, m_pDocument, @@ -987,8 +987,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { std::vector<std::pair<int32_t, int32_t>> arrIndex; CPDF_Array* pArray = pStream->GetDict()->GetArrayBy("Index"); if (pArray) { - FX_DWORD nPairSize = pArray->GetCount() / 2; - for (FX_DWORD i = 0; i < nPairSize; i++) { + uint32_t nPairSize = pArray->GetCount() / 2; + for (uint32_t i = 0; i < nPairSize; i++) { CPDF_Object* pStartNumObj = pArray->GetElement(i * 2); CPDF_Object* pCountObj = pArray->GetElement(i * 2 + 1); @@ -1010,9 +1010,9 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { return FALSE; } - CFX_ArrayTemplate<FX_DWORD> WidthArray; + CFX_ArrayTemplate<uint32_t> WidthArray; FX_SAFE_DWORD dwAccWidth = 0; - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { WidthArray.Add(pArray->GetIntegerAt(i)); dwAccWidth += WidthArray[i]; } @@ -1022,22 +1022,22 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { return FALSE; } - FX_DWORD totalWidth = dwAccWidth.ValueOrDie(); + uint32_t totalWidth = dwAccWidth.ValueOrDie(); CPDF_StreamAcc acc; acc.LoadAllData(pStream); const uint8_t* pData = acc.GetData(); - FX_DWORD dwTotalSize = acc.GetSize(); - FX_DWORD segindex = 0; - for (FX_DWORD i = 0; i < arrIndex.size(); i++) { + uint32_t dwTotalSize = acc.GetSize(); + uint32_t segindex = 0; + for (uint32_t i = 0; i < arrIndex.size(); i++) { int32_t startnum = arrIndex[i].first; if (startnum < 0) continue; m_dwXrefStartObjNum = - pdfium::base::checked_cast<FX_DWORD, int32_t>(startnum); - FX_DWORD count = - pdfium::base::checked_cast<FX_DWORD, int32_t>(arrIndex[i].second); + pdfium::base::checked_cast<uint32_t, int32_t>(startnum); + uint32_t count = + pdfium::base::checked_cast<uint32_t, int32_t>(arrIndex[i].second); FX_SAFE_DWORD dwCaculatedSize = segindex; dwCaculatedSize += count; dwCaculatedSize *= totalWidth; @@ -1049,11 +1049,11 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { const uint8_t* segstart = pData + segindex * totalWidth; FX_SAFE_DWORD dwMaxObjNum = startnum; dwMaxObjNum += count; - FX_DWORD dwV5Size = m_ObjectInfo.empty() ? 0 : GetLastObjNum() + 1; + uint32_t dwV5Size = m_ObjectInfo.empty() ? 0 : GetLastObjNum() + 1; if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) continue; - for (FX_DWORD j = 0; j < count; j++) { + for (uint32_t j = 0; j < count; j++) { int32_t type = 1; const uint8_t* entrystart = segstart + j * totalWidth; if (WidthArray[0]) @@ -1106,19 +1106,19 @@ CPDF_Array* CPDF_Parser::GetIDArray() { return ToArray(pID); } -FX_DWORD CPDF_Parser::GetRootObjNum() { +uint32_t CPDF_Parser::GetRootObjNum() { CPDF_Reference* pRef = ToReference(m_pTrailer ? m_pTrailer->GetElement("Root") : nullptr); return pRef ? pRef->GetRefObjNum() : 0; } -FX_DWORD CPDF_Parser::GetInfoObjNum() { +uint32_t CPDF_Parser::GetInfoObjNum() { CPDF_Reference* pRef = ToReference(m_pTrailer ? m_pTrailer->GetElement("Info") : nullptr); return pRef ? pRef->GetRefObjNum() : 0; } -FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) { +FX_BOOL CPDF_Parser::IsFormStream(uint32_t objnum, FX_BOOL& bForm) { bForm = FALSE; if (!IsValidObjectNumber(objnum)) return TRUE; @@ -1150,7 +1150,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) { CPDF_Object* CPDF_Parser::ParseIndirectObject( CPDF_IndirectObjectHolder* pObjList, - FX_DWORD objnum) { + uint32_t objnum) { if (!IsValidObjectNumber(objnum)) return nullptr; @@ -1158,7 +1158,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject( if (pdfium::ContainsKey(m_ParsingObjNums, objnum)) return nullptr; - pdfium::ScopedSetInsertion<FX_DWORD> local_insert(&m_ParsingObjNums, objnum); + pdfium::ScopedSetInsertion<uint32_t> local_insert(&m_ParsingObjNums, objnum); if (GetObjectType(objnum) == 1 || GetObjectType(objnum) == 255) { FX_FILESIZE pos = m_ObjectInfo[objnum].pos; if (pos <= 0) @@ -1181,8 +1181,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject( // Read object numbers from |pObjStream| into a cache. if (!pdfium::ContainsKey(m_ObjCache, pObjStream)) { for (int32_t i = GetStreamNCount(pObjStream); i > 0; --i) { - FX_DWORD thisnum = syntax.GetDirectNum(); - FX_DWORD thisoff = syntax.GetDirectNum(); + uint32_t thisnum = syntax.GetDirectNum(); + uint32_t thisoff = syntax.GetDirectNum(); m_ObjCache[pObjStream][thisnum] = thisoff; } } @@ -1195,7 +1195,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject( return syntax.GetObject(pObjList, 0, 0, true); } -CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) { +CPDF_StreamAcc* CPDF_Parser::GetObjectStream(uint32_t objnum) { auto it = m_ObjectStreamMap.find(objnum); if (it != m_ObjectStreamMap.end()) return it->second.get(); @@ -1213,7 +1213,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) { return pStreamAcc; } -FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) const { +FX_FILESIZE CPDF_Parser::GetObjectSize(uint32_t objnum) const { if (!IsValidObjectNumber(objnum)) return 0; @@ -1234,9 +1234,9 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) const { return *it - offset; } -void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, +void CPDF_Parser::GetIndirectBinary(uint32_t objnum, uint8_t*& pBuffer, - FX_DWORD& size) { + uint32_t& size) { pBuffer = nullptr; size = 0; if (!IsValidObjectNumber(objnum)) @@ -1249,15 +1249,15 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, int32_t offset = GetStreamFirst(pObjStream); const uint8_t* pData = pObjStream->GetData(); - FX_DWORD totalsize = pObjStream->GetSize(); + uint32_t totalsize = pObjStream->GetSize(); ScopedFileStream file( FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE)); CPDF_SyntaxParser syntax; syntax.InitParser(file.get(), 0); for (int i = GetStreamNCount(pObjStream); i > 0; --i) { - FX_DWORD thisnum = syntax.GetDirectNum(); - FX_DWORD thisoff = syntax.GetDirectNum(); + uint32_t thisnum = syntax.GetDirectNum(); + uint32_t thisoff = syntax.GetDirectNum(); if (thisnum != objnum) continue; @@ -1265,7 +1265,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, size = totalsize - (thisoff + offset); } else { syntax.GetDirectNum(); // Skip nextnum. - FX_DWORD nextoff = syntax.GetDirectNum(); + uint32_t nextoff = syntax.GetDirectNum(); size = nextoff - thisoff; } @@ -1293,7 +1293,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, return; } - FX_DWORD parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word); if (parser_objnum && parser_objnum != objnum) { m_pSyntax->RestorePos(SavedPos); return; @@ -1343,7 +1343,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, nextoff = m_pSyntax->SavePos(); } - size = (FX_DWORD)(nextoff - pos); + size = (uint32_t)(nextoff - pos); pBuffer = FX_Alloc(uint8_t, size); m_pSyntax->RestorePos(pos); m_pSyntax->ReadBlock(pBuffer, size); @@ -1353,7 +1353,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, CPDF_Object* CPDF_Parser::ParseIndirectObjectAt( CPDF_IndirectObjectHolder* pObjList, FX_FILESIZE pos, - FX_DWORD objnum) { + uint32_t objnum) { FX_FILESIZE SavedPos = m_pSyntax->SavePos(); m_pSyntax->RestorePos(pos); bool bIsNumber; @@ -1365,7 +1365,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt( FX_FILESIZE objOffset = m_pSyntax->SavePos(); objOffset -= word.GetLength(); - FX_DWORD parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word); if (objnum && parser_objnum != objnum) { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1377,7 +1377,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt( return nullptr; } - FX_DWORD parser_gennum = FXSYS_atoui(word); + uint32_t parser_gennum = FXSYS_atoui(word); if (m_pSyntax->GetKeyword() != "obj") { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1403,7 +1403,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt( CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict( CPDF_IndirectObjectHolder* pObjList, FX_FILESIZE pos, - FX_DWORD objnum, + uint32_t objnum, FX_FILESIZE* pResultPos) { FX_FILESIZE SavedPos = m_pSyntax->SavePos(); m_pSyntax->RestorePos(pos); @@ -1415,7 +1415,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict( return nullptr; } - FX_DWORD parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word); if (objnum && parser_objnum != objnum) { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1427,7 +1427,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict( return nullptr; } - FX_DWORD gennum = FXSYS_atoui(word); + uint32_t gennum = FXSYS_atoui(word); if (m_pSyntax->GetKeyword() != "obj") { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1452,11 +1452,11 @@ CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() { return pObj.release()->AsDictionary(); } -FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) { +uint32_t CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) { if (!m_pSecurityHandler) - return (FX_DWORD)-1; + return (uint32_t)-1; - FX_DWORD dwPermission = m_pSecurityHandler->GetPermissions(); + uint32_t dwPermission = m_pSecurityHandler->GetPermissions(); if (m_pEncryptDict && m_pEncryptDict->GetStringBy("Filter") == "Standard") { dwPermission &= 0xFFFFFFFC; dwPermission |= 0xFFFFF0C0; @@ -1467,7 +1467,7 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) { } FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, - FX_DWORD offset) { + uint32_t offset) { m_pSyntax->InitParser(pFileAccess, offset); m_pSyntax->RestorePos(m_pSyntax->m_HeaderOffset + 9); @@ -1477,12 +1477,12 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, if (!bIsNumber) return FALSE; - FX_DWORD objnum = FXSYS_atoui(word); + uint32_t objnum = FXSYS_atoui(word); word = m_pSyntax->GetNextWord(&bIsNumber); if (!bIsNumber) return FALSE; - FX_DWORD gennum = FXSYS_atoui(word); + uint32_t gennum = FXSYS_atoui(word); if (m_pSyntax->GetKeyword() != "obj") { m_pSyntax->RestorePos(SavedPos); return FALSE; @@ -1617,7 +1617,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos) { } CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() { - FX_DWORD dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum; + uint32_t dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum; m_pSyntax->m_MetadataObjnum = 0; if (m_pTrailer) { m_pTrailer->Release(); @@ -1626,7 +1626,7 @@ CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() { m_pSyntax->RestorePos(m_LastXRefOffset - m_pSyntax->m_HeaderOffset); uint8_t ch = 0; - FX_DWORD dwCount = 0; + uint32_t dwCount = 0; m_pSyntax->GetNextChar(ch); while (PDFCharIsWhitespace(ch)) { ++dwCount; diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp index 6aa8fe9b4a..9053d08b36 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp @@ -62,7 +62,7 @@ CPDF_Object* CPDF_Reference::Clone(FX_BOOL bDirect) const { return new CPDF_Reference(m_pObjList, m_RefObjNum); } -void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum) { +void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum) { m_pObjList = pDoc; m_RefObjNum = objnum; } diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp index a13fb0f365..e32021e25d 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp @@ -8,13 +8,13 @@ #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize) +CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize) : m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {} CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str) : m_pData(str.GetPtr()), m_dwSize(str.GetLength()), m_dwCurPos(0) {} -void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) { +void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) { pStart = nullptr; dwSize = 0; uint8_t ch; @@ -40,7 +40,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) { } } - FX_DWORD start_pos = m_dwCurPos - 1; + uint32_t start_pos = m_dwCurPos - 1; pStart = m_pData + start_pos; if (PDFCharIsDelimiter(ch)) { if (ch == '/') { @@ -93,7 +93,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) { CFX_ByteStringC CPDF_SimpleParser::GetWord() { const uint8_t* pStart; - FX_DWORD dwSize; + uint32_t dwSize; ParseWord(pStart, dwSize); if (dwSize == 1 && pStart[0] == '<') { while (m_dwCurPos < m_dwSize && m_pData[m_dwCurPos] != '>') { @@ -139,7 +139,7 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() { bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token, int nParams) { nParams++; - FX_DWORD* pBuf = FX_Alloc(FX_DWORD, nParams); + uint32_t* pBuf = FX_Alloc(uint32_t, nParams); int buf_index = 0; int buf_count = 0; m_dwCurPos = 0; diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp index 17ef914c80..46384244e8 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp @@ -15,8 +15,8 @@ IPDF_CryptoHandler::~IPDF_CryptoHandler() {} -void IPDF_CryptoHandler::Decrypt(FX_DWORD objnum, - FX_DWORD gennum, +void IPDF_CryptoHandler::Decrypt(uint32_t objnum, + uint32_t gennum, CFX_ByteString& str) { CFX_BinaryBuf dest_buf; void* context = DecryptStart(objnum, gennum); @@ -26,12 +26,12 @@ void IPDF_CryptoHandler::Decrypt(FX_DWORD objnum, } void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, - FX_DWORD objnum, - FX_DWORD gennum, + uint32_t objnum, + uint32_t gennum, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t* dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { if (m_Cipher == FXCIPHER_NONE) { FXSYS_memcpy(dest_buf, src_buf, src_size); return; @@ -96,11 +96,11 @@ struct AESCryptContext { uint8_t m_Context[2048]; FX_BOOL m_bIV; uint8_t m_Block[16]; - FX_DWORD m_BlockOffset; + uint32_t m_BlockOffset; }; -void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, - FX_DWORD gennum, +void* CPDF_StandardCryptoHandler::CryptStart(uint32_t objnum, + uint32_t gennum, FX_BOOL bEncrypt) { if (m_Cipher == FXCIPHER_NONE) { return this; @@ -151,7 +151,7 @@ void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, } FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt) { if (!context) { @@ -172,10 +172,10 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, dest_buf.AppendBlock(pContext->m_Block, 16); pContext->m_bIV = FALSE; } - FX_DWORD src_off = 0; - FX_DWORD src_left = src_size; + uint32_t src_off = 0; + uint32_t src_left = src_size; while (1) { - FX_DWORD copy_size = 16 - pContext->m_BlockOffset; + uint32_t copy_size = 16 - pContext->m_BlockOffset; if (copy_size > src_left) { copy_size = src_left; } @@ -244,11 +244,11 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, FX_Free(pContext); return TRUE; } -void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, - FX_DWORD gennum) { +void* CPDF_StandardCryptoHandler::DecryptStart(uint32_t objnum, + uint32_t gennum) { return CryptStart(objnum, gennum, FALSE); } -FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size) { +uint32_t CPDF_StandardCryptoHandler::DecryptGetSize(uint32_t src_size) { return m_Cipher == FXCIPHER_AES ? src_size - 16 : src_size; } @@ -306,7 +306,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, } FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(void* context, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_BinaryBuf& dest_buf) { return CryptStream(context, src_buf, src_size, dest_buf, FALSE); } @@ -314,21 +314,21 @@ 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, +uint32_t CPDF_StandardCryptoHandler::EncryptGetSize(uint32_t objnum, + uint32_t version, const uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t 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_BOOL CPDF_StandardCryptoHandler::EncryptContent(uint32_t objnum, + uint32_t gennum, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t* dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size); return TRUE; } diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h index c40fa7d0a4..689d44b81b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h @@ -17,38 +17,38 @@ class CPDF_StandardCryptoHandler : public IPDF_CryptoHandler { // IPDF_CryptoHandler FX_BOOL Init(CPDF_Dictionary* pEncryptDict, IPDF_SecurityHandler* pSecurityHandler) override; - FX_DWORD DecryptGetSize(FX_DWORD src_size) override; - void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) override; + uint32_t DecryptGetSize(uint32_t src_size) override; + void* DecryptStart(uint32_t objnum, uint32_t gennum) override; FX_BOOL DecryptStream(void* context, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_BinaryBuf& dest_buf) override; FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) override; - FX_DWORD EncryptGetSize(FX_DWORD objnum, - FX_DWORD version, + uint32_t EncryptGetSize(uint32_t objnum, + uint32_t version, const uint8_t* src_buf, - FX_DWORD src_size) override; - FX_BOOL EncryptContent(FX_DWORD objnum, - FX_DWORD version, + uint32_t src_size) override; + FX_BOOL EncryptContent(uint32_t objnum, + uint32_t version, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t* dest_buf, - FX_DWORD& dest_size) override; + uint32_t& dest_size) override; FX_BOOL Init(int cipher, const uint8_t* key, int keylen); protected: virtual void CryptBlock(FX_BOOL bEncrypt, - FX_DWORD objnum, - FX_DWORD gennum, + uint32_t objnum, + uint32_t gennum, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t* dest_buf, - FX_DWORD& dest_size); - virtual void* CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt); + uint32_t& dest_size); + virtual void* CryptStart(uint32_t objnum, uint32_t gennum, FX_BOOL bEncrypt); virtual FX_BOOL CryptStream(void* context, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt); virtual FX_BOOL CryptFinish(void* context, diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp index 14e7ed65d3..ac7667c3ea 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp @@ -24,14 +24,14 @@ const uint8_t defpasscode[32] = { void CalcEncryptKey(CPDF_Dictionary* pEncrypt, const uint8_t* password, - FX_DWORD pass_size, + uint32_t pass_size, uint8_t* key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray) { int revision = pEncrypt->GetIntegerBy("R"); uint8_t passcode[32]; - for (FX_DWORD i = 0; i < 32; i++) { + for (uint32_t i = 0; i < 32; i++) { passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size]; } uint8_t md5[100]; @@ -39,7 +39,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetStringBy("O"); CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength()); - FX_DWORD perm = pEncrypt->GetIntegerBy("P"); + uint32_t perm = pEncrypt->GetIntegerBy("P"); CRYPT_MD5Update(md5, (uint8_t*)&perm, 4); if (pIdArray) { CFX_ByteString id = pIdArray->GetStringAt(0); @@ -47,12 +47,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, } if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetIntegerBy("EncryptMetadata", 1)) { - FX_DWORD tag = (FX_DWORD)-1; + uint32_t tag = (uint32_t)-1; CRYPT_MD5Update(md5, (uint8_t*)&tag, 4); } uint8_t digest[16]; CRYPT_MD5Finish(md5, digest); - FX_DWORD copy_len = keylen; + uint32_t copy_len = keylen; if (copy_len > sizeof(digest)) { copy_len = sizeof(digest); } @@ -111,7 +111,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len) { return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey, key_len); } -FX_DWORD CPDF_StandardSecurityHandler::GetPermissions() { +uint32_t CPDF_StandardSecurityHandler::GetPermissions() { return m_Permissions; } static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict, @@ -180,7 +180,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) { } FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, - FX_DWORD type, + uint32_t type, int& cipher, int& key_len) { m_pEncryptDict = pEncryptDict; @@ -213,14 +213,14 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, } #define FX_GET_32WORD(n, b, i) \ { \ - (n) = (FX_DWORD)( \ + (n) = (uint32_t)( \ ((uint64_t)(b)[(i)] << 24) | ((uint64_t)(b)[(i) + 1] << 16) | \ ((uint64_t)(b)[(i) + 2] << 8) | ((uint64_t)(b)[(i) + 3])); \ } int BigOrder64BitsMod3(uint8_t* data) { uint64_t ret = 0; for (int i = 0; i < 4; ++i) { - FX_DWORD value; + uint32_t value; FX_GET_32WORD(value, data, 4 * i); ret <<= 32; ret |= value; @@ -229,7 +229,7 @@ int BigOrder64BitsMod3(uint8_t* data) { return (int)ret; } void Revision6_Hash(const uint8_t* password, - FX_DWORD size, + uint32_t size, const uint8_t* salt, const uint8_t* vector, uint8_t* hash) { @@ -306,7 +306,7 @@ void Revision6_Hash(const uint8_t* password, } FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword( const uint8_t* password, - FX_DWORD size, + uint32_t size, FX_BOOL bOwner, uint8_t* key) { CFX_ByteString okey = @@ -372,8 +372,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword( } uint8_t perms_buf[16]; FXSYS_memset(perms_buf, 0, sizeof(perms_buf)); - FX_DWORD copy_len = sizeof(perms_buf); - if (copy_len > (FX_DWORD)perms.GetLength()) { + uint32_t copy_len = sizeof(perms_buf); + if (copy_len > (uint32_t)perms.GetLength()) { copy_len = perms.GetLength(); } FXSYS_memcpy(perms_buf, (const uint8_t*)perms, copy_len); @@ -394,7 +394,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword( } int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, - FX_DWORD size, + uint32_t size, FX_BOOL bOwner, uint8_t* key, int32_t key_len) { @@ -413,7 +413,7 @@ int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, } FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword( const uint8_t* password, - FX_DWORD pass_size, + uint32_t pass_size, FX_BOOL bIgnoreEncryptMeta, uint8_t* key, int32_t key_len) { @@ -430,8 +430,8 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword( CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len); } else { uint8_t test[32], tmpkey[32]; - FX_DWORD copy_len = sizeof(test); - if (copy_len > (FX_DWORD)ukey.GetLength()) { + uint32_t copy_len = sizeof(test); + if (copy_len > (uint32_t)ukey.GetLength()) { copy_len = ukey.GetLength(); } FXSYS_memset(test, 0, sizeof(test)); @@ -461,11 +461,11 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword( } CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword( const uint8_t* owner_pass, - FX_DWORD pass_size, + uint32_t pass_size, int32_t key_len) { CFX_ByteString okey = m_pEncryptDict->GetStringBy("O"); uint8_t passcode[32]; - FX_DWORD i; + uint32_t i; for (i = 0; i < 32; i++) { passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size]; } @@ -478,7 +478,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword( } uint8_t enckey[32]; FXSYS_memset(enckey, 0, sizeof(enckey)); - FX_DWORD copy_len = key_len; + uint32_t copy_len = key_len; if (copy_len > sizeof(digest)) { copy_len = sizeof(digest); } @@ -510,7 +510,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword( } FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword( const uint8_t* password, - FX_DWORD pass_size, + uint32_t pass_size, uint8_t* key, int32_t key_len) { CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len); @@ -528,11 +528,11 @@ FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted() { void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, - FX_DWORD user_size, + uint32_t user_size, const uint8_t* owner_pass, - FX_DWORD owner_size, + uint32_t owner_size, FX_BOOL bDefault, - FX_DWORD type) { + uint32_t type) { int cipher = 0, key_len = 0; if (!LoadDict(pEncryptDict, type, cipher, key_len)) { return; @@ -561,7 +561,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, } if (bDefault) { uint8_t passcode[32]; - FX_DWORD i; + uint32_t i; for (i = 0; i < 32; i++) { passcode[i] = i < owner_size ? owner_pass[i] : defpasscode[i - owner_size]; @@ -622,24 +622,24 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, - FX_DWORD user_size, + uint32_t user_size, const uint8_t* owner_pass, - FX_DWORD owner_size, - FX_DWORD type) { + uint32_t owner_size, + uint32_t type) { OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size, TRUE, type); } void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, - FX_DWORD user_size, - FX_DWORD type) { + uint32_t user_size, + uint32_t type) { OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type); } void CPDF_StandardSecurityHandler::AES256_SetPassword( CPDF_Dictionary* pEncryptDict, const uint8_t* password, - FX_DWORD size, + uint32_t size, FX_BOOL bOwner, const uint8_t* key) { uint8_t sha[128]; @@ -687,7 +687,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword( } void CPDF_StandardSecurityHandler::AES256_SetPerms( CPDF_Dictionary* pEncryptDict, - FX_DWORD permissions, + uint32_t permissions, FX_BOOL bEncryptMetadata, const uint8_t* key) { uint8_t buf[16]; diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h index 8c1629c486..dfbf6a34f9 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h @@ -22,7 +22,7 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler { // IPDF_SecurityHandler: FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict) override; - FX_DWORD GetPermissions() override; + uint32_t GetPermissions() override; FX_BOOL GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen) override; @@ -32,22 +32,22 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler { void OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, - FX_DWORD user_size, + uint32_t user_size, const uint8_t* owner_pass, - FX_DWORD owner_size, - FX_DWORD type = PDF_ENCRYPT_CONTENT); + uint32_t owner_size, + uint32_t type = PDF_ENCRYPT_CONTENT); void OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, - FX_DWORD user_size, - FX_DWORD type = PDF_ENCRYPT_CONTENT); + uint32_t user_size, + uint32_t type = PDF_ENCRYPT_CONTENT); CFX_ByteString GetUserPassword(const uint8_t* owner_pass, - FX_DWORD pass_size, + uint32_t pass_size, int32_t key_len); int CheckPassword(const uint8_t* password, - FX_DWORD pass_size, + uint32_t pass_size, FX_BOOL bOwner, uint8_t* key, int key_len); @@ -55,48 +55,48 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler { private: FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict); FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict, - FX_DWORD type, + uint32_t type, int& cipher, int& key_len); FX_BOOL CheckUserPassword(const uint8_t* password, - FX_DWORD pass_size, + uint32_t pass_size, FX_BOOL bIgnoreEncryptMeta, uint8_t* key, int32_t key_len); FX_BOOL CheckOwnerPassword(const uint8_t* password, - FX_DWORD pass_size, + uint32_t pass_size, uint8_t* key, int32_t key_len); FX_BOOL AES256_CheckPassword(const uint8_t* password, - FX_DWORD size, + uint32_t size, FX_BOOL bOwner, uint8_t* key); void AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, - FX_DWORD size, + uint32_t size, FX_BOOL bOwner, const uint8_t* key); void AES256_SetPerms(CPDF_Dictionary* pEncryptDict, - FX_DWORD permission, + uint32_t permission, FX_BOOL bEncryptMetadata, const uint8_t* key); void OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, - FX_DWORD user_size, + uint32_t user_size, const uint8_t* owner_pass, - FX_DWORD owner_size, + uint32_t owner_size, FX_BOOL bDefault, - FX_DWORD type); + uint32_t type); FX_BOOL CheckSecurity(int32_t key_len); int m_Version; int m_Revision; CPDF_Parser* m_pParser; CPDF_Dictionary* m_pEncryptDict; - FX_DWORD m_Permissions; + uint32_t m_Permissions; int m_Cipher; uint8_t m_EncryptKey[32]; int m_KeyLen; diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp index 72ecb7e9de..108f487602 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp @@ -10,7 +10,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" -CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) +CPDF_Stream::CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict) : m_pDict(pDict), m_dwSize(size), m_GenNum(kMemoryBasedGenNum), @@ -58,7 +58,7 @@ void CPDF_Stream::InitStreamInternal(CPDF_Dictionary* pDict) { } void CPDF_Stream::InitStream(uint8_t* pData, - FX_DWORD size, + uint32_t size, CPDF_Dictionary* pDict) { InitStreamInternal(pDict); m_GenNum = kMemoryBasedGenNum; @@ -74,7 +74,7 @@ void CPDF_Stream::InitStream(uint8_t* pData, CPDF_Object* CPDF_Stream::Clone(FX_BOOL bDirect) const { CPDF_StreamAcc acc; acc.LoadAllData(this, TRUE); - FX_DWORD streamSize = acc.GetSize(); + uint32_t streamSize = acc.GetSize(); CPDF_Dictionary* pDict = GetDict(); if (pDict) pDict = ToDictionary(pDict->Clone(bDirect)); @@ -83,7 +83,7 @@ CPDF_Object* CPDF_Stream::Clone(FX_BOOL bDirect) const { } void CPDF_Stream::SetData(const uint8_t* pData, - FX_DWORD size, + uint32_t size, FX_BOOL bCompressed, FX_BOOL bKeepBuf) { if (IsMemoryBased()) @@ -110,7 +110,7 @@ void CPDF_Stream::SetData(const uint8_t* pData, FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, - FX_DWORD size) const { + uint32_t size) const { if (!IsMemoryBased() && m_pFile) return m_pFile->ReadBlock(buf, offset, size); @@ -124,7 +124,7 @@ void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict) { InitStreamInternal(pDict); m_pFile = pFile; - m_dwSize = (FX_DWORD)pFile->GetSize(); + m_dwSize = (uint32_t)pFile->GetSize(); if (m_pDict) m_pDict->SetAtInteger("Length", m_dwSize); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp index f10e33758c..afac3ebf6f 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp @@ -18,7 +18,7 @@ CPDF_StreamAcc::CPDF_StreamAcc() void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess, - FX_DWORD estimated_size, + uint32_t estimated_size, FX_BOOL bImageAcc) { if (!pStream) return; @@ -31,7 +31,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, return; } uint8_t* pSrcData; - FX_DWORD dwSrcSize = pStream->GetRawSize(); + uint32_t dwSrcSize = pStream->GetRawSize(); if (dwSrcSize == 0) return; @@ -43,7 +43,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, pSrcData = pStream->GetRawData(); } uint8_t* pDecryptedData = pSrcData; - FX_DWORD dwDecryptedSize = dwSrcSize; + uint32_t dwDecryptedSize = dwSrcSize; if (!pStream->GetDict()->KeyExist("Filter") || bRawAccess) { m_pData = pDecryptedData; m_dwSize = dwDecryptedSize; @@ -83,7 +83,7 @@ const uint8_t* CPDF_StreamAcc::GetData() const { return m_pStream->GetRawData(); } -FX_DWORD CPDF_StreamAcc::GetSize() const { +uint32_t CPDF_StreamAcc::GetSize() const { if (m_bNewBuf) { return m_dwSize; } diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index 00e2ee6a13..d14eeb991c 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -28,8 +28,8 @@ namespace { struct SearchTagRecord { const char* m_pTag; - FX_DWORD m_Len; - FX_DWORD m_Offset; + uint32_t m_Len; + uint32_t m_Offset; }; } // namespace @@ -60,14 +60,14 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) { if (m_BufOffset >= pos || (FX_FILESIZE)(m_BufOffset + m_BufSize) <= pos) { FX_FILESIZE read_pos = pos; - FX_DWORD read_size = m_BufSize; + uint32_t read_size = m_BufSize; if ((FX_FILESIZE)read_size > m_FileLen) - read_size = (FX_DWORD)m_FileLen; + read_size = (uint32_t)m_FileLen; if ((FX_FILESIZE)(read_pos + read_size) > m_FileLen) { if (m_FileLen < (FX_FILESIZE)read_size) { read_pos = 0; - read_size = (FX_DWORD)m_FileLen; + read_size = (uint32_t)m_FileLen; } else { read_pos = m_FileLen - read_size; } @@ -95,11 +95,11 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) { else read_pos = pos - m_BufSize + 1; - FX_DWORD read_size = m_BufSize; + uint32_t read_size = m_BufSize; if ((FX_FILESIZE)(read_pos + read_size) > m_FileLen) { if (m_FileLen < (FX_FILESIZE)read_size) { read_pos = 0; - read_size = (FX_DWORD)m_FileLen; + read_size = (uint32_t)m_FileLen; } else { read_pos = m_FileLen - read_size; } @@ -114,7 +114,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) { return TRUE; } -FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size) { +FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, uint32_t size) { if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size)) return FALSE; m_Pos += size; @@ -375,8 +375,8 @@ CFX_ByteString CPDF_SyntaxParser::GetKeyword() { } CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, - FX_DWORD objnum, - FX_DWORD gennum, + uint32_t objnum, + uint32_t gennum, FX_BOOL bDecrypt) { CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) @@ -394,7 +394,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, if (bIsNumber) { CFX_ByteString nextword2 = GetNextWord(nullptr); if (nextword2 == "R") { - FX_DWORD objnum = FXSYS_atoui(word); + uint32_t objnum = FXSYS_atoui(word); return new CPDF_Reference(pObjList, objnum); } } @@ -500,8 +500,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( CPDF_IndirectObjectHolder* pObjList, - FX_DWORD objnum, - FX_DWORD gennum) { + uint32_t objnum, + uint32_t gennum) { CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth); if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth) return nullptr; @@ -628,8 +628,8 @@ unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) { } CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, - FX_DWORD objnum, - FX_DWORD gennum) { + uint32_t objnum, + uint32_t gennum) { CPDF_Object* pLenObj = pDict->GetElement("Length"); FX_FILESIZE len = -1; CPDF_Reference* pLenObjRef = ToReference(pLenObj); @@ -647,7 +647,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, const CFX_ByteStringC kEndObjStr("endobj"); IPDF_CryptoHandler* pCryptoHandler = - objnum == (FX_DWORD)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get(); + objnum == (uint32_t)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get(); if (!pCryptoHandler) { FX_BOOL bSearchForKeyword = TRUE; if (len >= 0) { @@ -782,7 +782,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, } void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, - FX_DWORD HeaderOffset) { + uint32_t HeaderOffset) { FX_Free(m_pFileBuf); m_pFileBuf = FX_Alloc(uint8_t, m_BufSize); @@ -810,7 +810,7 @@ bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const CFX_ByteStringC& tag, FX_BOOL checkKeyword) { - const FX_DWORD taglen = tag.GetLength(); + const uint32_t taglen = tag.GetLength(); bool bCheckLeft = !PDFCharIsDelimiter(tag[0]) && !PDFCharIsWhitespace(tag[0]); bool bCheckRight = !PDFCharIsDelimiter(tag[taglen - 1]) && @@ -914,12 +914,12 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags, } std::vector<SearchTagRecord> patterns(ntags); - FX_DWORD start = 0; - FX_DWORD itag = 0; - FX_DWORD max_len = 0; + uint32_t start = 0; + uint32_t itag = 0; + uint32_t max_len = 0; for (int i = 0; i <= tags.GetLength(); ++i) { if (tags[i] == 0) { - FX_DWORD len = i - start; + uint32_t len = i - start; max_len = std::max(len, max_len); patterns[itag].m_pTag = tags.GetCStr() + start; patterns[itag].m_Len = len; diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h index 2e613d5cd9..26b6a8d3df 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h @@ -23,18 +23,18 @@ class CPDF_SyntaxParser { CPDF_SyntaxParser(); ~CPDF_SyntaxParser(); - void InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOffset); + void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset); FX_FILESIZE SavePos() const { return m_Pos; } void RestorePos(FX_FILESIZE pos) { m_Pos = pos; } CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList, - FX_DWORD objnum, - FX_DWORD gennum, + uint32_t objnum, + uint32_t gennum, FX_BOOL bDecrypt); CPDF_Object* GetObjectByStrict(CPDF_IndirectObjectHolder* pObjList, - FX_DWORD objnum, - FX_DWORD gennum); + uint32_t objnum, + uint32_t gennum); CFX_ByteString GetKeyword(); void ToNextLine(); @@ -51,7 +51,7 @@ class CPDF_SyntaxParser { void SetEncrypt(std::unique_ptr<IPDF_CryptoHandler> pCryptoHandler); - FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size); + FX_BOOL ReadBlock(uint8_t* pBuf, uint32_t size); FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch); CFX_ByteString GetNextWord(bool* bIsNumber); @@ -77,20 +77,20 @@ class CPDF_SyntaxParser { CFX_ByteString ReadHexString(); unsigned int ReadEOLMarkers(FX_FILESIZE pos); CPDF_Stream* ReadStream(CPDF_Dictionary* pDict, - FX_DWORD objnum, - FX_DWORD gennum); + uint32_t objnum, + uint32_t gennum); FX_FILESIZE m_Pos; int m_MetadataObjnum; IFX_FileRead* m_pFileAccess; - FX_DWORD m_HeaderOffset; + uint32_t m_HeaderOffset; FX_FILESIZE m_FileLen; uint8_t* m_pFileBuf; - FX_DWORD m_BufSize; + uint32_t m_BufSize; FX_FILESIZE m_BufOffset; std::unique_ptr<IPDF_CryptoHandler> m_pCryptoHandler; uint8_t m_WordBuffer[257]; - FX_DWORD m_WordSize; + uint32_t m_WordSize; }; #endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index e6f531da53..219a72507b 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -50,18 +50,18 @@ const uint16_t PDFDocEncoding[256] = { 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff}; -FX_DWORD A85Decode(const uint8_t* src_buf, - FX_DWORD src_size, +uint32_t A85Decode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { dest_size = 0; dest_buf = nullptr; if (src_size == 0) return 0; // Count legal characters and zeros. - FX_DWORD zcount = 0; - FX_DWORD pos = 0; + uint32_t zcount = 0; + uint32_t pos = 0; while (pos < src_size) { uint8_t ch = src_buf[pos]; if (ch == 'z') { @@ -78,9 +78,9 @@ FX_DWORD A85Decode(const uint8_t* src_buf, // Count the space needed to contain non-zero characters. The encoding ratio // of Ascii85 is 4:5. - FX_DWORD space_for_non_zeroes = (pos - zcount) / 5 * 4 + 4; + uint32_t space_for_non_zeroes = (pos - zcount) / 5 * 4 + 4; if (zcount > (UINT_MAX - space_for_non_zeroes) / 4) { - return (FX_DWORD)-1; + return (uint32_t)-1; } dest_buf = FX_Alloc(uint8_t, zcount * 4 + space_for_non_zeroes); size_t state = 0; @@ -123,17 +123,17 @@ FX_DWORD A85Decode(const uint8_t* src_buf, return pos; } -FX_DWORD HexDecode(const uint8_t* src_buf, - FX_DWORD src_size, +uint32_t HexDecode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { dest_size = 0; if (src_size == 0) { dest_buf = nullptr; return 0; } - FX_DWORD i = 0; + uint32_t i = 0; // Find the end of data. while (i < src_size && src_buf[i] != '>') i++; @@ -165,26 +165,26 @@ FX_DWORD HexDecode(const uint8_t* src_buf, return i; } -FX_DWORD RunLengthDecode(const uint8_t* src_buf, - FX_DWORD src_size, +uint32_t RunLengthDecode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { - FX_DWORD i = 0; - FX_DWORD old; + uint32_t& dest_size) { + uint32_t i = 0; + uint32_t old; dest_size = 0; while (i < src_size) { if (src_buf[i] < 128) { old = dest_size; dest_size += src_buf[i] + 1; if (dest_size < old) { - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } i += src_buf[i] + 2; } else if (src_buf[i] > 128) { old = dest_size; dest_size += 257 - src_buf[i]; if (dest_size < old) { - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } i += 2; } else { @@ -192,17 +192,17 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, } } if (dest_size >= _STREAM_MAX_SIZE_) { - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } dest_buf = FX_Alloc(uint8_t, dest_size); i = 0; int dest_count = 0; while (i < src_size) { if (src_buf[i] < 128) { - FX_DWORD copy_len = src_buf[i] + 1; - FX_DWORD buf_left = src_size - i - 1; + uint32_t copy_len = src_buf[i] + 1; + uint32_t buf_left = src_size - i - 1; if (buf_left < copy_len) { - FX_DWORD delta = copy_len - buf_left; + uint32_t delta = copy_len - buf_left; copy_len = buf_left; FXSYS_memset(dest_buf + dest_count + copy_len, '\0', delta); } @@ -221,7 +221,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, break; } } - FX_DWORD ret = i + 1; + uint32_t ret = i + 1; if (ret > src_size) { ret = src_size; } @@ -230,7 +230,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, const CPDF_Dictionary* pParams) { @@ -283,7 +283,7 @@ static FX_BOOL CheckFlateDecodeParams(int Colors, ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -305,13 +305,13 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( BitsPerComponent, Columns); } -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, +uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CPDF_Dictionary* pParams, - FX_DWORD estimated_size, + uint32_t estimated_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { int predictor = 0; FX_BOOL bEarlyChange = TRUE; int Colors = 0, BitsPerComponent = 0, Columns = 0; @@ -322,7 +322,7 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8); Columns = pParams->GetIntegerBy("Columns", 1); if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { - return (FX_DWORD)-1; + return (uint32_t)-1; } } return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode( @@ -331,13 +331,13 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, } FX_BOOL PDF_DataDecode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, const CPDF_Dictionary* pDict, uint8_t*& dest_buf, - FX_DWORD& dest_size, + uint32_t& dest_size, CFX_ByteString& ImageEncoding, CPDF_Dictionary*& pImageParms, - FX_DWORD last_estimated_size, + uint32_t last_estimated_size, FX_BOOL bImageAcc) { CPDF_Object* pDecoder = pDict ? pDict->GetElementValue("Filter") : nullptr; if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName())) @@ -352,7 +352,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, if (!pParamsArray) pParams = nullptr; - for (FX_DWORD i = 0; i < pDecoders->GetCount(); i++) { + for (uint32_t i = 0; i < pDecoders->GetCount(); i++) { DecoderList.push_back(pDecoders->GetConstStringAt(i)); ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr); } @@ -361,7 +361,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, ParamList.Add(pParams ? pParams->GetDict() : nullptr); } uint8_t* last_buf = (uint8_t*)src_buf; - FX_DWORD last_size = src_size; + uint32_t last_size = src_size; int nSize = pdfium::CollectionSize<int>(DecoderList); for (int i = 0; i < nSize; i++) { int estimated_size = i == nSize - 1 ? last_estimated_size : 0; @@ -369,7 +369,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, // Use ToDictionary here because we can push nullptr into the ParamList. CPDF_Dictionary* pParam = ToDictionary(ParamList[i]); uint8_t* new_buf = nullptr; - FX_DWORD new_size = (FX_DWORD)-1; + uint32_t new_size = (uint32_t)-1; int offset = -1; if (decoder == "FlateDecode" || decoder == "Fl") { if (bImageAcc && i == nSize - 1) { @@ -431,12 +431,12 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf, return TRUE; } -CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) { +CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) { CFX_WideString result; if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) || (src_data[0] == 0xff && src_data[1] == 0xfe))) { bool bBE = src_data[0] == 0xfe; - FX_DWORD max_chars = (src_len - 2) / 2; + uint32_t max_chars = (src_len - 2) / 2; if (!max_chars) { return result; } @@ -446,7 +446,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) { 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) { + for (uint32_t i = 0; i < max_chars * 2; i += 2) { uint16_t unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1]) : (uni_str[i + 1] << 8 | uni_str[i]); if (unicode == 0x1b) { @@ -466,7 +466,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) { result.ReleaseBuffer(dest_pos); } else { FX_WCHAR* dest_buf = result.GetBuffer(src_len); - for (FX_DWORD i = 0; i < src_len; i++) + for (uint32_t i = 0; i < src_len; i++) dest_buf[i] = PDFDocEncoding[src_data[i]]; result.ReleaseBuffer(src_len); } @@ -554,9 +554,9 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) { } void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size); @@ -564,13 +564,13 @@ void FlateEncode(const uint8_t* src_buf, } void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, @@ -579,10 +579,10 @@ void FlateEncode(const uint8_t* src_buf, } } -FX_DWORD FlateDecode(const uint8_t* src_buf, - FX_DWORD src_size, +uint32_t FlateDecode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); if (pEncoders) { return pEncoders->GetFlateModule()->FlateOrLZWDecode( diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp index 81f8cae354..352e4ee15c 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp @@ -29,7 +29,7 @@ TEST(fpdf_parser_decode, A85Decode) { for (size_t i = 0; i < FX_ArraySize(test_data); ++i) { pdfium::DecodeTestData* ptr = &test_data[i]; uint8_t* result = nullptr; - FX_DWORD result_size; + uint32_t result_size; EXPECT_EQ(ptr->processed_size, A85Decode(ptr->input, ptr->input_size, result, result_size)) << "for case " << i; @@ -64,7 +64,7 @@ TEST(fpdf_parser_decode, HexDecode) { for (size_t i = 0; i < FX_ArraySize(test_data); ++i) { pdfium::DecodeTestData* ptr = &test_data[i]; uint8_t* result = nullptr; - FX_DWORD result_size; + uint32_t result_size; EXPECT_EQ(ptr->processed_size, HexDecode(ptr->input, ptr->input_size, result, result_size)) << "for case " << i; diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index caffb6861b..5bfbfaebac 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -179,7 +179,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) { case CPDF_Object::ARRAY: { const CPDF_Array* p = pObj->AsArray(); buf << "["; - for (FX_DWORD i = 0; i < p->GetCount(); i++) { + for (uint32_t i = 0; i < p->GetCount(); i++) { CPDF_Object* pElement = p->GetElement(i); if (pElement->GetObjNum()) { buf << " " << pElement->GetObjNum() << " 0 R"; diff --git a/core/fpdfapi/fpdf_parser/include/cfdf_document.h b/core/fpdfapi/fpdf_parser/include/cfdf_document.h index f01039cd4e..18b9442fa9 100644 --- a/core/fpdfapi/fpdf_parser/include/cfdf_document.h +++ b/core/fpdfapi/fpdf_parser/include/cfdf_document.h @@ -18,7 +18,7 @@ class CFDF_Document : public CPDF_IndirectObjectHolder { static CFDF_Document* CreateNewDoc(); static CFDF_Document* ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile = FALSE); - static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size); + static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size); ~CFDF_Document(); FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const; diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h index 2ee7760a77..3efa03e0d5 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h @@ -24,34 +24,34 @@ class CPDF_Array : public CPDF_Object { CPDF_Array* AsArray() override; const CPDF_Array* AsArray() const override; - FX_DWORD GetCount() const { return m_Objects.GetSize(); } - CPDF_Object* GetElement(FX_DWORD index) const; - CPDF_Object* GetElementValue(FX_DWORD index) const; + uint32_t GetCount() const { return m_Objects.GetSize(); } + CPDF_Object* GetElement(uint32_t index) const; + CPDF_Object* GetElementValue(uint32_t index) const; CFX_Matrix GetMatrix(); CFX_FloatRect GetRect(); - CFX_ByteString GetStringAt(FX_DWORD index) const; - CFX_ByteStringC GetConstStringAt(FX_DWORD index) const; - int GetIntegerAt(FX_DWORD index) const; - FX_FLOAT GetNumberAt(FX_DWORD index) const; - CPDF_Dictionary* GetDictAt(FX_DWORD index) const; - CPDF_Stream* GetStreamAt(FX_DWORD index) const; - CPDF_Array* GetArrayAt(FX_DWORD index) const; - FX_FLOAT GetFloatAt(FX_DWORD index) const { return GetNumberAt(index); } + CFX_ByteString GetStringAt(uint32_t index) const; + CFX_ByteStringC GetConstStringAt(uint32_t index) const; + int GetIntegerAt(uint32_t index) const; + FX_FLOAT GetNumberAt(uint32_t index) const; + CPDF_Dictionary* GetDictAt(uint32_t index) const; + CPDF_Stream* GetStreamAt(uint32_t index) const; + CPDF_Array* GetArrayAt(uint32_t index) const; + FX_FLOAT GetFloatAt(uint32_t index) const { return GetNumberAt(index); } - void SetAt(FX_DWORD index, + void SetAt(uint32_t index, CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr); - void InsertAt(FX_DWORD index, + void InsertAt(uint32_t index, CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr); - void RemoveAt(FX_DWORD index, int nCount = 1); + void RemoveAt(uint32_t index, int nCount = 1); void Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr); void AddNumber(FX_FLOAT f); void AddInteger(int i); void AddString(const CFX_ByteString& str); void AddName(const CFX_ByteString& str); - void AddReference(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum); + void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); void AddReference(CPDF_IndirectObjectHolder* pDoc, CPDF_Object* obj) { AddReference(pDoc, obj->GetObjNum()); } diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h index ebc5cee90a..73eabf9368 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h @@ -65,7 +65,7 @@ class CPDF_Dictionary : public CPDF_Object { void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f); void SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectObjectHolder* pDoc, - FX_DWORD objnum); + uint32_t objnum); void SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectObjectHolder* pDoc, CPDF_Object* obj) { @@ -77,7 +77,7 @@ class CPDF_Dictionary : public CPDF_Object { void AddReference(const CFX_ByteStringC& key, CPDF_IndirectObjectHolder* pDoc, - FX_DWORD objnum); + uint32_t objnum); // Invalidates iterators for the element with the key |key|. void RemoveAt(const CFX_ByteStringC& key); diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h index 21b9d250fd..bbccf59361 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h @@ -50,8 +50,8 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { int GetPageCount() const; CPDF_Dictionary* GetPage(int iPage); - int GetPageIndex(FX_DWORD objnum); - FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const; + int GetPageIndex(uint32_t objnum); + uint32_t GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const; CPDF_DocPageData* GetPageData() { return GetValidatePageData(); } void ClearPageData(); void RemoveColorSpaceFromPageData(CPDF_Object* pObject); @@ -60,7 +60,7 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { void ClearRenderData(); void ClearRenderFont(); - FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const; + FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm) const; // |pFontDict| must not be null. CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); @@ -110,8 +110,8 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { int nPagesToGo, int level); int _FindPageIndex(CPDF_Dictionary* pNode, - FX_DWORD& skip_count, - FX_DWORD objnum, + uint32_t& skip_count, + uint32_t objnum, int& index, int level = 0); FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting); @@ -127,9 +127,9 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { CFX_ByteString m_ID1; CFX_ByteString m_ID2; FX_BOOL m_bLinearized; - FX_DWORD m_dwFirstPageNo; - FX_DWORD m_dwFirstPageObjNum; - CFX_ArrayTemplate<FX_DWORD> m_PageList; + uint32_t m_dwFirstPageNo; + uint32_t m_dwFirstPageObjNum; + CFX_ArrayTemplate<uint32_t> m_PageList; CPDF_DocPageData* m_pDocPage; CPDF_DocRenderData* m_pDocRender; }; diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h index 373159d060..a219181179 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h @@ -16,20 +16,20 @@ class CPDF_Parser; class CPDF_IndirectObjectHolder { public: - using iterator = std::map<FX_DWORD, CPDF_Object*>::iterator; - using const_iterator = std::map<FX_DWORD, CPDF_Object*>::const_iterator; + using iterator = std::map<uint32_t, CPDF_Object*>::iterator; + using const_iterator = std::map<uint32_t, CPDF_Object*>::const_iterator; explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser); ~CPDF_IndirectObjectHolder(); - CPDF_Object* GetIndirectObject(FX_DWORD objnum); - FX_DWORD AddIndirectObject(CPDF_Object* pObj); - void ReleaseIndirectObject(FX_DWORD objnum); + CPDF_Object* GetIndirectObject(uint32_t objnum); + uint32_t AddIndirectObject(CPDF_Object* pObj); + void ReleaseIndirectObject(uint32_t objnum); // Takes ownership of |pObj|. - FX_BOOL InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj); + FX_BOOL InsertIndirectObject(uint32_t objnum, CPDF_Object* pObj); - FX_DWORD GetLastObjNum() const { return m_LastObjNum; } + uint32_t GetLastObjNum() const { return m_LastObjNum; } iterator begin() { return m_IndirectObjs.begin(); } const_iterator begin() const { return m_IndirectObjs.begin(); } iterator end() { return m_IndirectObjs.end(); } @@ -37,8 +37,8 @@ class CPDF_IndirectObjectHolder { protected: CPDF_Parser* m_pParser; - FX_DWORD m_LastObjNum; - std::map<FX_DWORD, CPDF_Object*> m_IndirectObjs; + uint32_t m_LastObjNum; + std::map<uint32_t, CPDF_Object*> m_IndirectObjs; }; #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h index cc461d6218..1ba38a946e 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h @@ -35,8 +35,8 @@ class CPDF_Object { }; virtual Type GetType() const = 0; - FX_DWORD GetObjNum() const { return m_ObjNum; } - FX_DWORD GetGenNum() const { return m_GenNum; } + uint32_t GetObjNum() const { return m_ObjNum; } + uint32_t GetGenNum() const { return m_GenNum; } virtual CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const = 0; virtual CPDF_Object* GetDirect() const; @@ -85,8 +85,8 @@ class CPDF_Object { virtual ~CPDF_Object(); void Destroy() { delete this; } - FX_DWORD m_ObjNum; - FX_DWORD m_GenNum; + uint32_t m_ObjNum; + uint32_t m_GenNum; friend class CPDF_IndirectObjectHolder; friend class CPDF_Parser; diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h index 933ab1c7fa..45aca8f21a 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h @@ -38,7 +38,7 @@ class CPDF_Parser { ~CPDF_Parser(); Error StartParse(IFX_FileRead* pFile); - FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); + uint32_t GetPermissions(FX_BOOL bCheckRevision = FALSE); void SetPassword(const FX_CHAR* password) { m_Password = password; } CFX_ByteString GetPassword() { return m_Password; } @@ -46,46 +46,46 @@ class CPDF_Parser { FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } CPDF_Document* GetDocument() const { return m_pDocument; } - FX_DWORD GetRootObjNum(); - FX_DWORD GetInfoObjNum(); + uint32_t GetRootObjNum(); + uint32_t GetInfoObjNum(); CPDF_Array* GetIDArray(); CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; } CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, - FX_DWORD objnum); + uint32_t objnum); - FX_DWORD GetLastObjNum() const; - bool IsValidObjectNumber(FX_DWORD objnum) const; - FX_FILESIZE GetObjectPositionOrZero(FX_DWORD objnum) const; - uint8_t GetObjectType(FX_DWORD objnum) const; - uint16_t GetObjectGenNum(FX_DWORD objnum) const; + uint32_t GetLastObjNum() const; + bool IsValidObjectNumber(uint32_t objnum) const; + FX_FILESIZE GetObjectPositionOrZero(uint32_t objnum) const; + uint8_t GetObjectType(uint32_t objnum) const; + uint16_t GetObjectGenNum(uint32_t objnum) const; bool IsVersionUpdated() const { return m_bVersionUpdated; } - bool IsObjectFreeOrNull(FX_DWORD objnum) const; - FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); + bool IsObjectFreeOrNull(uint32_t objnum) const; + FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm); IPDF_CryptoHandler* GetCryptoHandler(); IFX_FileRead* GetFileAccess() const; - FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const; - FX_FILESIZE GetObjectSize(FX_DWORD objnum) const; + FX_FILESIZE GetObjectOffset(uint32_t objnum) const; + FX_FILESIZE GetObjectSize(uint32_t objnum) const; - void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); + void GetIndirectBinary(uint32_t objnum, uint8_t*& pBuffer, uint32_t& size); int GetFileVersion() const { return m_FileVersion; } FX_BOOL IsXRefStream() const { return m_bXRefStream; } CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, FX_FILESIZE pos, - FX_DWORD objnum); + uint32_t objnum); CPDF_Object* ParseIndirectObjectAtByStrict( CPDF_IndirectObjectHolder* pObjList, FX_FILESIZE pos, - FX_DWORD objnum, + uint32_t objnum, FX_FILESIZE* pResultPos); Error StartAsyncParse(IFX_FileRead* pFile); - FX_DWORD GetFirstPageNo() const { return m_dwFirstPageNo; } + uint32_t GetFirstPageNo() const { return m_dwFirstPageNo; } protected: struct ObjectInfo { @@ -106,14 +106,14 @@ class CPDF_Parser { FX_BOOL RebuildCrossRef(); Error SetEncryptHandler(); void ReleaseEncryptHandler(); - FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); - FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); + FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount); + FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount); FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); Error LoadLinearizedMainXRefTable(); - CPDF_StreamAcc* GetObjectStream(FX_DWORD number); - FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); + CPDF_StreamAcc* GetObjectStream(uint32_t number); + FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset); void SetEncryptDictionary(CPDF_Dictionary* pDict); - void ShrinkObjectMap(FX_DWORD size); + void ShrinkObjectMap(uint32_t size); CPDF_Document* m_pDocument; std::unique_ptr<CPDF_SyntaxParser> m_pSyntax; @@ -127,27 +127,27 @@ class CPDF_Parser { CFX_ByteString m_bsRecipient; CFX_ByteString m_FilePath; CFX_ByteString m_Password; - std::map<FX_DWORD, ObjectInfo> m_ObjectInfo; + std::map<uint32_t, ObjectInfo> m_ObjectInfo; std::set<FX_FILESIZE> m_SortedOffset; CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers; bool m_bVersionUpdated; CPDF_Object* m_pLinearized; - FX_DWORD m_dwFirstPageNo; - FX_DWORD m_dwXrefStartObjNum; + uint32_t m_dwFirstPageNo; + uint32_t m_dwXrefStartObjNum; // A map of object numbers to indirect streams. Map owns the streams. - std::map<FX_DWORD, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap; + std::map<uint32_t, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap; // Mapping of object numbers to offsets. The offsets are relative to the first // object in the stream. - using StreamObjectCache = std::map<FX_DWORD, FX_DWORD>; + using StreamObjectCache = std::map<uint32_t, uint32_t>; // Mapping of streams to their object caches. This is valid as long as the // streams in |m_ObjectStreamMap| are valid. std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache; // All indirect object numbers that are being parsed. - std::set<FX_DWORD> m_ParsingObjNums; + std::set<uint32_t> m_ParsingObjNums; friend class CPDF_DataAvail; diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h index f44f1e437b..b7d826902b 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h @@ -31,9 +31,9 @@ class CPDF_Reference : public CPDF_Object { const CPDF_Reference* AsReference() const override; CPDF_IndirectObjectHolder* GetObjList() const { return m_pObjList; } - FX_DWORD GetRefObjNum() const { return m_RefObjNum; } + uint32_t GetRefObjNum() const { return m_RefObjNum; } - void SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum); + void SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum); protected: ~CPDF_Reference() override; @@ -45,7 +45,7 @@ class CPDF_Reference : public CPDF_Object { } CPDF_IndirectObjectHolder* m_pObjList; - FX_DWORD m_RefObjNum; + uint32_t m_RefObjNum; }; #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h index 0bd3b8daac..c9aa12eaa9 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h @@ -12,7 +12,7 @@ class CPDF_SimpleParser { public: - CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize); + CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize); CPDF_SimpleParser(const CFX_ByteStringC& str); CFX_ByteStringC GetWord(); @@ -22,14 +22,14 @@ class CPDF_SimpleParser { bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams); // For testing only. - FX_DWORD GetCurPos() const { return m_dwCurPos; } + uint32_t GetCurPos() const { return m_dwCurPos; } private: - void ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize); + void ParseWord(const uint8_t*& pStart, uint32_t& dwSize); const uint8_t* m_pData; - FX_DWORD m_dwSize; - FX_DWORD m_dwCurPos; + uint32_t m_dwSize; + uint32_t m_dwCurPos; }; #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h index 20045d7aa2..0010a1528e 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h @@ -13,7 +13,7 @@ class CPDF_Stream : public CPDF_Object { public: - CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); + CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict); // CPDF_Object. Type GetType() const override; @@ -24,33 +24,33 @@ class CPDF_Stream : public CPDF_Object { CPDF_Stream* AsStream() override; const CPDF_Stream* AsStream() const override; - FX_DWORD GetRawSize() const { return m_dwSize; } + uint32_t GetRawSize() const { return m_dwSize; } uint8_t* GetRawData() const { return m_pDataBuf; } void SetData(const uint8_t* pData, - FX_DWORD size, + uint32_t size, FX_BOOL bCompressed, FX_BOOL bKeepBuf); - void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); + void InitStream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict); void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict); FX_BOOL ReadRawData(FX_FILESIZE start_pos, uint8_t* pBuf, - FX_DWORD buf_size) const; + uint32_t buf_size) const; bool IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; } protected: - static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1; + static const uint32_t kMemoryBasedGenNum = (uint32_t)-1; ~CPDF_Stream() override; void InitStreamInternal(CPDF_Dictionary* pDict); CPDF_Dictionary* m_pDict; - FX_DWORD m_dwSize; - FX_DWORD m_GenNum; + uint32_t m_dwSize; + uint32_t m_GenNum; union { uint8_t* m_pDataBuf; diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h index 8fad265a75..6176753deb 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h @@ -19,7 +19,7 @@ class CPDF_StreamAcc { void LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess = FALSE, - FX_DWORD estimated_size = 0, + uint32_t estimated_size = 0, FX_BOOL bImageAcc = FALSE); const CPDF_Stream* GetStream() const { return m_pStream; } @@ -28,14 +28,14 @@ class CPDF_StreamAcc { } const uint8_t* GetData() const; - FX_DWORD GetSize() const; + uint32_t GetSize() const; const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } uint8_t* DetachData(); protected: uint8_t* m_pData; - FX_DWORD m_dwSize; + uint32_t m_dwSize; FX_BOOL m_bNewBuf; CFX_ByteString m_ImageDecoder; CPDF_Dictionary* m_pImageParam; diff --git a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h index 4a1d66cabb..1f1095b396 100644 --- a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h +++ b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h @@ -19,58 +19,58 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex = FALSE); -CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size); +CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size); CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); CFX_ByteString PDF_EncodeText(const CFX_WideString& str); void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, - FX_DWORD& dest_size); -FX_DWORD FlateDecode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t& dest_size); +uint32_t FlateDecode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); -FX_DWORD RunLengthDecode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t& dest_size); +uint32_t RunLengthDecode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); // Public for testing. -FX_DWORD A85Decode(const uint8_t* src_buf, - FX_DWORD src_size, +uint32_t A85Decode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); // Public for testing. -FX_DWORD HexDecode(const uint8_t* src_buf, - FX_DWORD src_size, +uint32_t HexDecode(const uint8_t* src_buf, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); // Public for testing. -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, +uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CPDF_Dictionary* pParams, - FX_DWORD estimated_size, + uint32_t estimated_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); FX_BOOL PDF_DataDecode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, const CPDF_Dictionary* pDict, uint8_t*& dest_buf, - FX_DWORD& dest_size, + uint32_t& dest_size, CFX_ByteString& ImageEncoding, CPDF_Dictionary*& pImageParms, - FX_DWORD estimated_size, + uint32_t estimated_size, FX_BOOL bImageAcc); #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_ diff --git a/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h index d92c06d0cd..e34761ae78 100644 --- a/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h +++ b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h @@ -46,13 +46,13 @@ class IPDF_DataAvail { class FileAvail { public: virtual ~FileAvail(); - virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) = 0; + virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0; }; class DownloadHints { public: virtual ~DownloadHints(); - virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) = 0; + virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0; }; static IPDF_DataAvail* Create(FileAvail* pFileAvail, IFX_FileRead* pFileRead); @@ -68,7 +68,7 @@ class IPDF_DataAvail { virtual DocFormStatus IsFormAvail(DownloadHints* pHints) = 0; virtual DocLinearizationStatus IsLinearizedPDF() = 0; virtual void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, - FX_DWORD* pSize) = 0; + uint32_t* pSize) = 0; protected: IPDF_DataAvail(FileAvail* pFileAvail, IFX_FileRead* pFileRead); diff --git a/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h index 8e83589a16..ea45a6b9cc 100644 --- a/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h +++ b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h @@ -19,27 +19,27 @@ class IPDF_CryptoHandler { virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict, IPDF_SecurityHandler* pSecurityHandler) = 0; - virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0; - virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; + virtual uint32_t DecryptGetSize(uint32_t src_size) = 0; + virtual void* DecryptStart(uint32_t objnum, uint32_t gennum) = 0; virtual FX_BOOL DecryptStream(void* context, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_BinaryBuf& dest_buf) = 0; virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) = 0; - virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, - FX_DWORD version, + virtual uint32_t EncryptGetSize(uint32_t objnum, + uint32_t version, const uint8_t* src_buf, - FX_DWORD src_size) = 0; + uint32_t src_size) = 0; - virtual FX_BOOL EncryptContent(FX_DWORD objnum, - FX_DWORD version, + virtual FX_BOOL EncryptContent(uint32_t objnum, + uint32_t version, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t* dest_buf, - FX_DWORD& dest_size) = 0; + uint32_t& dest_size) = 0; - void Decrypt(FX_DWORD objnum, FX_DWORD version, CFX_ByteString& str); + void Decrypt(uint32_t objnum, uint32_t version, CFX_ByteString& str); }; #endif // CORE_FPDFAPI_FPDF_PARSER_IPDF_CRYPTO_HANDLER_H_ diff --git a/core/fpdfapi/fpdf_parser/ipdf_security_handler.h b/core/fpdfapi/fpdf_parser/ipdf_security_handler.h index fd70b1fac6..e7eb822a83 100644 --- a/core/fpdfapi/fpdf_parser/ipdf_security_handler.h +++ b/core/fpdfapi/fpdf_parser/ipdf_security_handler.h @@ -24,7 +24,7 @@ class IPDF_SecurityHandler { virtual FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict) = 0; - virtual FX_DWORD GetPermissions() = 0; + virtual uint32_t GetPermissions() = 0; virtual FX_BOOL GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen) = 0; diff --git a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h index 578700c30d..4e47e019b4 100644 --- a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h +++ b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h @@ -30,17 +30,17 @@ class CPDF_PageRenderCache { ~CPDF_PageRenderCache(); void ClearImageData(); - FX_DWORD EstimateSize(); + uint32_t EstimateSize(); void CacheOptimization(int32_t dwLimitCacheSize); - FX_DWORD GetTimeCount() const { return m_nTimeCount; } - void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; } + uint32_t GetTimeCount() const { return m_nTimeCount; } + void SetTimeCount(uint32_t dwTimeCount) { m_nTimeCount = dwTimeCount; } void GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, - FX_DWORD& MatteColor, + uint32_t& MatteColor, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, @@ -55,7 +55,7 @@ class CPDF_PageRenderCache { FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, @@ -69,8 +69,8 @@ class CPDF_PageRenderCache { CPDF_Page* const m_pPage; CPDF_ImageCacheEntry* m_pCurImageCacheEntry; std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache; - FX_DWORD m_nTimeCount; - FX_DWORD m_nCacheSize; + uint32_t m_nTimeCount; + uint32_t m_nCacheSize; FX_BOOL m_bCurFindCache; }; diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 24ca282322..216613cc61 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -208,7 +208,7 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext, FX_BOOL bStdCS, CPDF_Type3Char* pType3Char, FX_ARGB fill_color, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask) { m_pContext = pContext; m_pDevice = pDevice; @@ -508,11 +508,11 @@ FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj, if (FillType == 0 && !bStroke) { return TRUE; } - FX_DWORD fill_argb = 0; + uint32_t fill_argb = 0; if (FillType) { fill_argb = GetFillArgb(pPathObj); } - FX_DWORD stroke_argb = 0; + uint32_t stroke_argb = 0; if (bStroke) { stroke_argb = GetStrokeArgb(pPathObj); } @@ -569,7 +569,7 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, m_InitialStates.m_ColorState; } FX_COLORREF rgb = pColorData->m_FillRGB; - if (rgb == (FX_DWORD)-1) { + if (rgb == (uint32_t)-1) { return 0; } const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; @@ -603,7 +603,7 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const { m_InitialStates.m_ColorState; } FX_COLORREF rgb = pColorData->m_StrokeRGB; - if (rgb == (FX_DWORD)-1) { + if (rgb == (uint32_t)-1) { return 0; } const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState; @@ -847,7 +847,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, pTextMask->Clear(0); CFX_FxgeDevice text_device; text_device.Attach(pTextMask.get()); - for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { + for (uint32_t i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); if (!textobj) { break; @@ -1156,7 +1156,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { if (pArray->GetCount() < 3) return nullptr; - for (FX_DWORD i = 0; i < 3; ++i) { + for (uint32_t i = 0; i < 3; ++i) { pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetElementValue(i))); if (!pFuncs[2 - i]) return nullptr; diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp index 15c7dcffcc..f5bc584348 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -15,7 +15,7 @@ #include "core/include/fxge/fx_ge.h" struct CACHEINFO { - FX_DWORD time; + uint32_t time; CPDF_Stream* pStream; }; @@ -30,7 +30,7 @@ CPDF_PageRenderCache::~CPDF_PageRenderCache() { delete it.second; } void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { - if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize) + if (m_nCacheSize <= (uint32_t)dwLimitCacheSize) return; size_t nCount = m_ImageCache.size(); @@ -41,10 +41,10 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { pCACHEINFO[i++].pStream = it.second->GetStream(); } FXSYS_qsort(pCACHEINFO, nCount, sizeof(CACHEINFO), compare); - FX_DWORD nTimeCount = m_nTimeCount; + uint32_t nTimeCount = m_nTimeCount; // Check if time value is about to roll over and reset all entries. - // The comparision is legal because FX_DWORD is an unsigned type. + // The comparision is legal because uint32_t is an unsigned type. if (nTimeCount + 1 < nTimeCount) { for (i = 0; i < nCount; i++) m_ImageCache[pCACHEINFO[i].pStream]->m_dwTimeCount = i; @@ -55,7 +55,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) { while (i + 15 < nCount) ClearImageCacheEntry(pCACHEINFO[i++].pStream); - while (i < nCount && m_nCacheSize > (FX_DWORD)dwLimitCacheSize) + while (i < nCount && m_nCacheSize > (uint32_t)dwLimitCacheSize) ClearImageCacheEntry(pCACHEINFO[i++].pStream); FX_Free(pCACHEINFO); @@ -69,8 +69,8 @@ void CPDF_PageRenderCache::ClearImageCacheEntry(CPDF_Stream* pStream) { delete it->second; m_ImageCache.erase(it); } -FX_DWORD CPDF_PageRenderCache::EstimateSize() { - FX_DWORD dwSize = 0; +uint32_t CPDF_PageRenderCache::EstimateSize() { + uint32_t dwSize = 0; for (const auto& it : m_ImageCache) dwSize += it.second->EstimateSize(); @@ -80,9 +80,9 @@ FX_DWORD CPDF_PageRenderCache::EstimateSize() { void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, - FX_DWORD& MatteColor, + uint32_t& MatteColor, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, @@ -109,7 +109,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap( CPDF_Stream* pStream, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, @@ -197,18 +197,18 @@ void CPDF_ImageCacheEntry::ClearImageData() { ((CPDF_DIBSource*)m_pCachedBitmap)->ClearImageData(); } } -static FX_DWORD FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) { +static uint32_t FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) { return pDIB && pDIB->GetBuffer() - ? (FX_DWORD)pDIB->GetHeight() * pDIB->GetPitch() + - (FX_DWORD)pDIB->GetPaletteSize() * 4 + ? (uint32_t)pDIB->GetHeight() * pDIB->GetPitch() + + (uint32_t)pDIB->GetPaletteSize() * 4 : 0; } FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, - FX_DWORD& MatteColor, + uint32_t& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, @@ -264,7 +264,7 @@ CFX_DIBSource* CPDF_ImageCacheEntry::DetachMask() { int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index b28aee6980..ef452daa4e 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -57,7 +57,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, return; } } else { - FX_DWORD fill_argb = m_Options.TranslateColor(mask_argb); + uint32_t fill_argb = m_Options.TranslateColor(mask_argb); if (bitmap_alpha < 255) { ((uint8_t*)&fill_argb)[3] = ((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255; @@ -137,7 +137,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, std::unique_ptr<CFX_DIBitmap> pBackdrop1(new CFX_DIBitmap); pBackdrop1->Create(pBackdrop->GetWidth(), pBackdrop->GetHeight(), FXDIB_Rgb32); - pBackdrop1->Clear((FX_DWORD)-1); + pBackdrop1->Clear((uint32_t)-1); pBackdrop1->CompositeBitmap(0, 0, pBackdrop->GetWidth(), pBackdrop->GetHeight(), pBackdrop.get(), 0, 0); pBackdrop = std::move(pBackdrop1); @@ -221,7 +221,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf, *dest_buf++ = m_RampG[FXARGB_G(src_argb)]; *dest_buf++ = m_RampR[FXARGB_B(src_argb)]; } else { - FX_DWORD src_byte = *src_buf; + uint32_t src_byte = *src_buf; *dest_buf++ = m_RampB[src_byte]; *dest_buf++ = m_RampG[src_byte]; *dest_buf++ = m_RampR[src_byte]; @@ -417,7 +417,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { m_Flags |= FXRENDER_IMAGE_LOSSY; } } else if (CPDF_Array* pArray = pFilters->AsArray()) { - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { CFX_ByteStringC bsDecodeType = pArray->GetConstStringAt(i); if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { m_Flags |= FXRENDER_IMAGE_LOSSY; @@ -494,7 +494,7 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, - FX_DWORD flags, + uint32_t flags, FX_BOOL bStdCS, int blendType) { m_pRenderStatus = pStatus; @@ -788,7 +788,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { CFX_PathData path; path.AppendRect(0, 0, 1, 1); path.Transform(&m_ImageMatrix); - FX_DWORD fill_color = + uint32_t fill_color = ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha); m_pRenderStatus->m_pDevice->DrawPath(&path, NULL, NULL, fill_color, 0, FXFILL_WINDING); @@ -868,7 +868,7 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { } ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -925,7 +925,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); if (pCS) { FX_FLOAT R, G, B; - FX_DWORD comps = 8; + uint32_t comps = 8; if (pCS->CountComponents() > comps) { comps = pCS->CountComponents(); } diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 1ad091e7af..6ed50ead56 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -38,7 +38,7 @@ unsigned int GetBits8(const uint8_t* pData, uint64_t bitpos, size_t nbits) { return (byte >> (8 - nbits - (bitpos % 8))) & ((1 << nbits) - 1); } -FX_SAFE_DWORD CalculatePitch8(FX_DWORD bpc, FX_DWORD components, int width) { +FX_SAFE_DWORD CalculatePitch8(uint32_t bpc, uint32_t components, int width) { FX_SAFE_DWORD pitch = bpc; pitch *= components; pitch *= width; @@ -147,11 +147,11 @@ void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const { FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CPDF_DIBSource** ppMask, - FX_DWORD* pMatteColor, + uint32_t* pMatteColor, CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask) { if (!pStream) { return FALSE; @@ -274,7 +274,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask) { if (!pStream) { return 0; @@ -480,7 +480,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, int max_data = (1 << m_bpc) - 1; CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode"); if (pDecode) { - for (FX_DWORD i = 0; i < m_nComponents; i++) { + for (uint32_t i = 0; i < m_nComponents; i++) { pCompData[i].m_DecodeMin = pDecode->GetNumberAt(i * 2); FX_FLOAT max = pDecode->GetNumberAt(i * 2 + 1); pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_data; @@ -496,7 +496,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, } } } else { - for (FX_DWORD i = 0; i < m_nComponents; i++) { + for (uint32_t i = 0; i < m_nComponents; i++) { FX_FLOAT def_value; m_pColorSpace->GetDefaultValue(i, def_value, pCompData[i].m_DecodeMin, pCompData[i].m_DecodeStep); @@ -514,7 +514,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, } if (CPDF_Array* pArray = pMask->AsArray()) { if (pArray->GetCount() >= m_nComponents * 2) { - for (FX_DWORD i = 0; i < m_nComponents; i++) { + for (uint32_t i = 0; i < m_nComponents; i++) { int min_num = pArray->GetIntegerAt(i * 2); int max_num = pArray->GetIntegerAt(i * 2 + 1); pCompData[i].m_ColorKeyMin = std::max(min_num, 0); @@ -529,14 +529,14 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, const CPDF_Dictionary* pParams); ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -552,7 +552,7 @@ int CPDF_DIBSource::CreateDecoder() { return 0; } const uint8_t* src_data = m_pStreamAcc->GetData(); - FX_DWORD src_size = m_pStreamAcc->GetSize(); + uint32_t src_size = m_pStreamAcc->GetSize(); const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam(); if (decoder == "CCITTFaxDecode") { m_pDecoder.reset(FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, @@ -568,9 +568,9 @@ int CPDF_DIBSource::CreateDecoder() { ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule(); if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, comps, bpc, bTransform)) { - if (m_nComponents != static_cast<FX_DWORD>(comps)) { + if (m_nComponents != static_cast<uint32_t>(comps)) { FX_Free(m_pCompData); - m_nComponents = static_cast<FX_DWORD>(comps); + m_nComponents = static_cast<uint32_t>(comps); if (m_Family == PDFCS_LAB && m_nComponents != 3) { m_pCompData = nullptr; return 0; @@ -638,9 +638,9 @@ void CPDF_DIBSource::LoadJpxBitmap() { if (!context->decoder()) return; - FX_DWORD width = 0; - FX_DWORD height = 0; - FX_DWORD components = 0; + uint32_t width = 0; + uint32_t height = 0; + uint32_t components = 0; pJpxModule->GetImageInfo(context->decoder(), &width, &height, &components); if (static_cast<int>(width) < m_Width || static_cast<int>(height) < m_Height) return; @@ -682,7 +682,7 @@ void CPDF_DIBSource::LoadJpxBitmap() { } m_pCachedBitmap->Clear(0xFFFFFFFF); std::vector<uint8_t> output_offsets(components); - for (FX_DWORD i = 0; i < components; ++i) + for (uint32_t i = 0; i < components; ++i) output_offsets[i] = i; if (bSwapRGB) { output_offsets[0] = 2; @@ -696,10 +696,10 @@ void CPDF_DIBSource::LoadJpxBitmap() { if (m_pColorSpace && m_pColorSpace->GetFamily() == PDFCS_INDEXED && m_bpc < 8) { int scale = 8 - m_bpc; - for (FX_DWORD row = 0; row < height; ++row) { + for (uint32_t row = 0; row < height; ++row) { uint8_t* scanline = const_cast<uint8_t*>(m_pCachedBitmap->GetScanline(row)); - for (FX_DWORD col = 0; col < width; ++col) { + for (uint32_t col = 0; col < width; ++col) { *scanline = (*scanline) >> scale; ++scanline; } @@ -708,7 +708,7 @@ void CPDF_DIBSource::LoadJpxBitmap() { m_bpc = 8; } -CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) { +CPDF_DIBSource* CPDF_DIBSource::LoadMask(uint32_t& MatteColor) { MatteColor = 0xFFFFFFFF; CPDF_Stream* pSoftMask = m_pDict->GetStreamBy("SMask"); if (pSoftMask) { @@ -716,7 +716,7 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) { if (pMatte && m_pColorSpace && m_pColorSpace->CountComponents() <= m_nComponents) { std::vector<FX_FLOAT> colors(m_nComponents); - for (FX_DWORD i = 0; i < m_nComponents; i++) { + for (uint32_t i = 0; i < m_nComponents; i++) { colors[i] = pMatte->GetFloatAt(i); } FX_FLOAT R, G, B; @@ -742,7 +742,7 @@ int CPDF_DIBSource::StratLoadMask() { m_pColorSpace->CountComponents() <= m_nComponents) { FX_FLOAT R, G, B; std::vector<FX_FLOAT> colors(m_nComponents); - for (FX_DWORD i = 0; i < m_nComponents; i++) { + for (uint32_t i = 0; i < m_nComponents; i++) { colors[i] = pMatte->GetFloatAt(i); } m_pColorSpace->GetRGB(colors.data(), R, G, B); @@ -853,7 +853,7 @@ void CPDF_DIBSource::LoadPalette() { FX_FLOAT* color_value = color_values; for (int i = 0; i < palette_count; i++) { int color_data = i; - for (FX_DWORD j = 0; j < m_nComponents; j++) { + for (uint32_t j = 0; j < m_nComponents; j++) { int encoded_component = color_data % (1 << m_bpc); color_data /= 1 << m_bpc; color_value[j] = m_pCompData[j].m_DecodeMin + @@ -972,7 +972,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, uint64_t src_byte_pos = 0; size_t dest_byte_pos = 0; for (int column = 0; column < m_Width; column++) { - for (FX_DWORD color = 0; color < m_nComponents; color++) { + for (uint32_t color = 0; color < m_nComponents; color++) { uint8_t data = src_scan[src_byte_pos++]; color_values[color] = m_pCompData[color].m_DecodeMin + m_pCompData[color].m_DecodeStep * data; @@ -997,7 +997,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan, uint64_t src_bit_pos = 0; size_t dest_byte_pos = 0; for (int column = 0; column < m_Width; column++) { - for (FX_DWORD color = 0; color < m_nComponents; color++) { + for (uint32_t color = 0; color < m_nComponents; color++) { unsigned int data = GetBits8(src_scan, src_bit_pos, m_bpc); color_values[color] = m_pCompData[color].m_DecodeMin + m_pCompData[color].m_DecodeStep * data; @@ -1033,7 +1033,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { FX_SAFE_DWORD src_pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width); if (!src_pitch.IsValid()) return nullptr; - FX_DWORD src_pitch_value = src_pitch.ValueOrDie(); + uint32_t src_pitch_value = src_pitch.ValueOrDie(); const uint8_t* pSrcLine = nullptr; if (m_pCachedBitmap && src_pitch_value <= m_pCachedBitmap->GetPitch()) { if (line >= m_pCachedBitmap->GetHeight()) { @@ -1054,11 +1054,11 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { } if (m_bpc * m_nComponents == 1) { if (m_bImageMask && m_bDefaultDecode) { - for (FX_DWORD i = 0; i < src_pitch_value; i++) { + for (uint32_t i = 0; i < src_pitch_value; i++) { m_pLineBuf[i] = ~pSrcLine[i]; } } else if (m_bColorKey) { - FX_DWORD reset_argb, set_argb; + uint32_t reset_argb, set_argb; reset_argb = m_pPalette ? m_pPalette[0] : 0xFF000000; set_argb = m_pPalette ? m_pPalette[1] : 0xFFFFFFFF; if (m_pCompData[0].m_ColorKeyMin == 0) { @@ -1069,7 +1069,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { } set_argb = FXARGB_TODIB(set_argb); reset_argb = FXARGB_TODIB(reset_argb); - FX_DWORD* dest_scan = reinterpret_cast<FX_DWORD*>(m_pMaskedLine); + uint32_t* dest_scan = reinterpret_cast<uint32_t*>(m_pMaskedLine); for (int col = 0; col < m_Width; col++) { if (pSrcLine[col / 8] & (1 << (7 - col % 8))) { *dest_scan = set_argb; @@ -1091,7 +1091,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { uint64_t src_bit_pos = 0; for (int col = 0; col < m_Width; col++) { unsigned int color_index = 0; - for (FX_DWORD color = 0; color < m_nComponents; color++) { + for (uint32_t color = 0; color < m_nComponents; color++) { unsigned int data = GetBits8(pSrcLine, src_bit_pos, m_bpc); color_index |= data << (color * m_bpc); src_bit_pos += m_bpc; @@ -1175,7 +1175,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, return; } - FX_DWORD src_width = m_Width; + uint32_t src_width = m_Width; FX_SAFE_DWORD pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width); if (!pitch.IsValid()) return; @@ -1186,7 +1186,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, } else if (m_pDecoder) { pSrcLine = m_pDecoder->GetScanline(line); } else { - FX_DWORD src_pitch = pitch.ValueOrDie(); + uint32_t src_pitch = pitch.ValueOrDie(); pitch *= (line + 1); if (!pitch.IsValid()) { return; @@ -1224,19 +1224,19 @@ void CPDF_DIBSource::DownSampleScanline(int line, void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, int dest_Bpp, - FX_DWORD src_width, + uint32_t src_width, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const { - FX_DWORD set_argb = (FX_DWORD)-1; - FX_DWORD reset_argb = 0; + uint32_t set_argb = (uint32_t)-1; + uint32_t reset_argb = 0; if (m_bImageMask) { if (m_bDefaultDecode) { set_argb = 0; - reset_argb = (FX_DWORD)-1; + reset_argb = (uint32_t)-1; } } else if (m_bColorKey) { reset_argb = m_pPalette ? m_pPalette[0] : 0xFF000000; @@ -1249,9 +1249,9 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, } set_argb = FXARGB_TODIB(set_argb); reset_argb = FXARGB_TODIB(reset_argb); - FX_DWORD* dest_scan_dword = reinterpret_cast<FX_DWORD*>(dest_scan); + uint32_t* dest_scan_dword = reinterpret_cast<uint32_t*>(dest_scan); for (int i = 0; i < clip_width; i++) { - FX_DWORD src_x = (clip_left + i) * src_width / dest_width; + uint32_t src_x = (clip_left + i) * src_width / dest_width; if (bFlipX) { src_x = src_width - src_x - 1; } @@ -1271,7 +1271,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, } } for (int i = 0; i < clip_width; i++) { - FX_DWORD src_x = (clip_left + i) * src_width / dest_width; + uint32_t src_x = (clip_left + i) * src_width / dest_width; if (bFlipX) { src_x = src_width - src_x - 1; } @@ -1285,7 +1285,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, dest_scan[dest_pos + 1] = FXARGB_G(set_argb); dest_scan[dest_pos + 2] = FXARGB_R(set_argb); } else { - *reinterpret_cast<FX_DWORD*>(dest_scan + dest_pos) = set_argb; + *reinterpret_cast<uint32_t*>(dest_scan + dest_pos) = set_argb; } } else { if (dest_Bpp == 1) { @@ -1295,7 +1295,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, dest_scan[dest_pos + 1] = FXARGB_G(reset_argb); dest_scan[dest_pos + 2] = FXARGB_R(reset_argb); } else { - *reinterpret_cast<FX_DWORD*>(dest_scan + dest_pos) = reset_argb; + *reinterpret_cast<uint32_t*>(dest_scan + dest_pos) = reset_argb; } } } @@ -1303,7 +1303,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp, void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, int dest_Bpp, - FX_DWORD src_width, + uint32_t src_width, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, @@ -1312,9 +1312,9 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, int clip_width) const { if (m_bpc < 8) { uint64_t src_bit_pos = 0; - for (FX_DWORD col = 0; col < src_width; col++) { + for (uint32_t col = 0; col < src_width; col++) { unsigned int color_index = 0; - for (FX_DWORD color = 0; color < m_nComponents; color++) { + for (uint32_t color = 0; color < m_nComponents; color++) { unsigned int data = GetBits8(pSrcLine, src_bit_pos, m_bpc); color_index |= data << (color * m_bpc); src_bit_pos += m_bpc; @@ -1325,7 +1325,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, } if (m_bColorKey) { for (int i = 0; i < clip_width; i++) { - FX_DWORD src_x = (clip_left + i) * src_width / dest_width; + uint32_t src_x = (clip_left + i) * src_width / dest_width; if (bFlipX) { src_x = src_width - src_x - 1; } @@ -1349,7 +1349,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, return; } for (int i = 0; i < clip_width; i++) { - FX_DWORD src_x = (clip_left + i) * src_width / dest_width; + uint32_t src_x = (clip_left + i) * src_width / dest_width; if (bFlipX) { src_x = src_width - src_x - 1; } @@ -1369,7 +1369,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp, void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, int dest_Bpp, - FX_DWORD src_width, + uint32_t src_width, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, @@ -1378,12 +1378,12 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, int clip_width) const { // last_src_x used to store the last seen src_x position which should be // in [0, src_width). Set the initial value to be an invalid src_x value. - FX_DWORD last_src_x = src_width; + uint32_t last_src_x = src_width; FX_ARGB last_argb = FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF); FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1); for (int i = 0; i < clip_width; i++) { int dest_x = clip_left + i; - FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * + uint32_t src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) * (int64_t)src_width / dest_width; src_x %= src_width; @@ -1401,7 +1401,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, size_t num_bits = src_x * m_bpc * m_nComponents; uint64_t src_bit_pos = num_bits % 8; pSrcPixel = pSrcLine + num_bits / 8; - for (FX_DWORD j = 0; j < m_nComponents; ++j) { + for (uint32_t j = 0; j < m_nComponents; ++j) { extracted_components[j] = static_cast<uint8_t>( GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc); src_bit_pos += m_bpc; @@ -1410,7 +1410,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, } else { pSrcPixel = pSrcLine + src_x * orig_Bpp; if (m_bpc == 16) { - for (FX_DWORD j = 0; j < m_nComponents; ++j) + for (uint32_t j = 0; j < m_nComponents; ++j) extracted_components[j] = pSrcPixel[j * 2]; pSrcPixel = extracted_components; } @@ -1423,7 +1423,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0, bTransMask); } else { - for (FX_DWORD j = 0; j < m_nComponents; ++j) { + for (uint32_t j = 0; j < m_nComponents; ++j) { FX_FLOAT component_value = static_cast<FX_FLOAT>(extracted_components[j]); int color_value = static_cast<int>( @@ -1460,7 +1460,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp, last_argb = argb; } if (dest_Bpp == 4) { - *reinterpret_cast<FX_DWORD*>(pDestPixel) = FXARGB_TODIB(argb); + *reinterpret_cast<uint32_t*>(pDestPixel) = FXARGB_TODIB(argb); } else { *pDestPixel++ = FXARGB_B(argb); *pDestPixel++ = FXARGB_G(argb); @@ -1500,7 +1500,7 @@ FX_BOOL CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, @@ -1565,7 +1565,7 @@ FX_BOOL CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, CPDF_ImageLoaderHandle*& LoadHandle, FX_BOOL bStdCS, - FX_DWORD GroupFamily, + uint32_t GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t nDownsampleWidth, diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 94f38c5186..9c1fa36b28 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -70,7 +70,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap, CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); FX_FLOAT* pResults = result_array; FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); - FX_DWORD rgb_array[SHADING_STEPS]; + uint32_t rgb_array[SHADING_STEPS]; for (int i = 0; i < SHADING_STEPS; i++) { FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min; int offset = 0; @@ -90,7 +90,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap, } int pitch = pBitmap->GetPitch(); for (int row = 0; row < height; row++) { - FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); + uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; matrix.Transform(x, y); @@ -156,7 +156,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap, CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results); FX_FLOAT* pResults = result_array; FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); - FX_DWORD rgb_array[SHADING_STEPS]; + uint32_t rgb_array[SHADING_STEPS]; for (int i = 0; i < SHADING_STEPS; i++) { FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min; int offset = 0; @@ -189,7 +189,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap, } } for (int row = 0; row < height; row++) { - FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); + uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; matrix.Transform(x, y); @@ -286,7 +286,7 @@ static void DrawFuncShading(CFX_DIBitmap* pBitmap, FX_FLOAT* pResults = result_array; FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); for (int row = 0; row < height; row++) { - FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch); + uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row; matrix.Transform(x, y); @@ -432,7 +432,7 @@ static void DrawFreeGouraudShading(CFX_DIBitmap* pBitmap, while (!stream.m_BitStream.IsEOF()) { CPDF_MeshVertex vertex; - FX_DWORD flag = stream.GetVertex(vertex, pObject2Bitmap); + uint32_t flag = stream.GetVertex(vertex, pObject2Bitmap); if (flag == 0) { triangle[0] = vertex; for (int j = 1; j < 3; j++) { @@ -782,7 +782,7 @@ static void DrawCoonPatchMeshes(FX_BOOL bTensor, CFX_PointF coords[16]; int point_count = bTensor ? 16 : 12; while (!stream.m_BitStream.IsEOF()) { - FX_DWORD flag = stream.GetFlag(); + uint32_t flag = stream.GetFlag(); int iStartPoint = 0, iStartColor = 0, i = 0; if (flag) { iStartPoint = 4; @@ -1141,7 +1141,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, return; } screen.Clear(0); - FX_DWORD* src_buf = (FX_DWORD*)pPatternBitmap->GetBuffer(); + uint32_t* src_buf = (uint32_t*)pPatternBitmap->GetBuffer(); for (int col = min_col; col <= max_col; col++) { for (int row = min_row; row <= max_row; row++) { int start_x, start_y; @@ -1160,8 +1160,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, start_y >= clip_box.Height()) { continue; } - FX_DWORD* dest_buf = - (FX_DWORD*)(screen.GetBuffer() + screen.GetPitch() * start_y + + uint32_t* dest_buf = + (uint32_t*)(screen.GetBuffer() + screen.GetPitch() * start_y + start_x * 4); if (pPattern->m_bColored) { *dest_buf = *src_buf; diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index 04b0c93507..c38362fb70 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -29,7 +29,7 @@ CPDF_Type3Cache::~CPDF_Type3Cache() { } m_SizeMap.clear(); } -CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode, +CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode, const CFX_Matrix* pMatrix, FX_FLOAT retinaScaleX, FX_FLOAT retinaScaleY) { @@ -130,7 +130,7 @@ static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) { return -1; } CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, - FX_DWORD charcode, + uint32_t charcode, const CFX_Matrix* pMatrix, FX_FLOAT retinaScaleX, FX_FLOAT retinaScaleY) { @@ -192,10 +192,10 @@ void _CPDF_UniqueKeyGen::Generate(int count, ...) { va_start(argList, count); for (int i = 0; i < count; i++) { int p = va_arg(argList, int); - ((FX_DWORD*)m_Key)[i] = p; + ((uint32_t*)m_Key)[i] = p; } va_end(argList); - m_KeyLen = count * sizeof(FX_DWORD); + m_KeyLen = count * sizeof(uint32_t); } FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX_Matrix* pObj2Device, @@ -334,7 +334,7 @@ class CPDF_RefType3Cache { ReleaseCachedType3(m_pType3Font); } } - FX_DWORD m_dwCount; + uint32_t m_dwCount; CPDF_Type3Font* m_pType3Font; }; FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, @@ -362,13 +362,13 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, return FALSE; } CPDF_RefType3Cache refTypeCache(pType3Font); - FX_DWORD* pChars = textobj->m_pCharCodes; + uint32_t* pChars = textobj->m_pCharCodes; if (textobj->m_nChars == 1) { - pChars = (FX_DWORD*)(&textobj->m_pCharCodes); + pChars = (uint32_t*)(&textobj->m_pCharCodes); } for (int iChar = 0; iChar < textobj->m_nChars; iChar++) { - FX_DWORD charcode = pChars[iChar]; - if (charcode == (FX_DWORD)-1) { + uint32_t charcode = pChars[iChar]; + if (charcode == (uint32_t)-1) { continue; } CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode); @@ -501,12 +501,12 @@ class CPDF_CharPosList { CPDF_CharPosList(); ~CPDF_CharPosList(); void Load(int nChars, - FX_DWORD* pCharCodes, + uint32_t* pCharCodes, FX_FLOAT* pCharPos, CPDF_Font* pFont, FX_FLOAT font_size); FXTEXT_CHARPOS* m_pCharPos; - FX_DWORD m_nChars; + uint32_t m_nChars; }; CPDF_CharPosList::CPDF_CharPosList() { @@ -516,7 +516,7 @@ CPDF_CharPosList::~CPDF_CharPosList() { FX_Free(m_pCharPos); } void CPDF_CharPosList::Load(int nChars, - FX_DWORD* pCharCodes, + uint32_t* pCharCodes, FX_FLOAT* pCharPos, CPDF_Font* pFont, FX_FLOAT FontSize) { @@ -525,9 +525,9 @@ void CPDF_CharPosList::Load(int nChars, CPDF_CIDFont* pCIDFont = pFont->AsCIDFont(); FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); for (int iChar = 0; iChar < nChars; iChar++) { - FX_DWORD CharCode = - nChars == 1 ? (FX_DWORD)(uintptr_t)pCharCodes : pCharCodes[iChar]; - if (CharCode == (FX_DWORD)-1) { + uint32_t CharCode = + nChars == 1 ? (uint32_t)(uintptr_t)pCharCodes : pCharCodes[iChar]; + if (CharCode == (uint32_t)-1) { continue; } FX_BOOL bVert = FALSE; @@ -575,7 +575,7 @@ void CPDF_CharPosList::Load(int nChars, } FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, int nChars, - FX_DWORD* pCharCodes, + uint32_t* pCharCodes, FX_FLOAT* pCharPos, CPDF_Font* pFont, FX_FLOAT font_size, @@ -629,16 +629,16 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, if (nChars == 0) { return; } - FX_DWORD charcode; + uint32_t charcode; int offset = 0; - FX_DWORD* pCharCodes; + uint32_t* pCharCodes; FX_FLOAT* pCharPos; if (nChars == 1) { charcode = pFont->GetNextChar(str, str.GetLength(), offset); - pCharCodes = (FX_DWORD*)(uintptr_t)charcode; + pCharCodes = (uint32_t*)(uintptr_t)charcode; pCharPos = NULL; } else { - pCharCodes = FX_Alloc(FX_DWORD, nChars); + pCharCodes = FX_Alloc(uint32_t, nChars); pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); FX_FLOAT cur_pos = 0; for (int i = 0; i < nChars; i++) { @@ -673,7 +673,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, } FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, int nChars, - FX_DWORD* pCharCodes, + uint32_t* pCharCodes, FX_FLOAT* pCharPos, CPDF_Font* pFont, FX_FLOAT font_size, @@ -687,7 +687,7 @@ FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); int FXGE_flags = 0; if (pOptions) { - FX_DWORD dwFlags = pOptions->m_Flags; + uint32_t dwFlags = pOptions->m_Flags; if (dwFlags & RENDER_CLEARTYPE) { FXGE_flags |= FXTEXT_CLEARTYPE; if (dwFlags & RENDER_BGR_STRIPE) { @@ -750,7 +750,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, CPDF_CharPosList CharPosList; CharPosList.Load(textobj->m_nChars, textobj->m_pCharCodes, textobj->m_pCharPos, pFont, font_size); - for (FX_DWORD i = 0; i < CharPosList.m_nChars; i++) { + for (uint32_t i = 0; i < CharPosList.m_nChars; i++) { FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i]; const CFX_PathData* pPath = pFaceCache->LoadGlyphPath( &pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth); diff --git a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h index 11ece71406..96e30412d5 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h @@ -54,7 +54,7 @@ class CPDF_ProgressiveRenderer { const CPDF_RenderOptions* const m_pOptions; std::unique_ptr<CPDF_RenderStatus> m_pRenderStatus; CFX_FloatRect m_ClipRect; - FX_DWORD m_LayerIndex; + uint32_t m_LayerIndex; CPDF_RenderContext::Layer* m_pCurrentLayer; CPDF_PageObjectList::iterator m_LastObjectRendered; }; diff --git a/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h index b2566ad007..2974a658b4 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h @@ -50,8 +50,8 @@ class CPDF_RenderContext { const CPDF_RenderOptions* pOptions, CFX_Matrix* pFinalMatrix); - FX_DWORD CountLayers() const { return m_Layers.GetSize(); } - Layer* GetLayer(FX_DWORD index) { return m_Layers.GetDataPtr(index); } + uint32_t CountLayers() const { return m_Layers.GetSize(); } + Layer* GetLayer(uint32_t index) { return m_Layers.GetDataPtr(index); } CPDF_Document* GetDocument() const { return m_pDocument; } CPDF_Dictionary* GetPageResources() const { return m_pPageResources; } diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h index f28fae4f3d..a78838ac58 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h @@ -41,11 +41,11 @@ class CPDF_RenderOptions { int m_ColorMode; FX_COLORREF m_BackColor; FX_COLORREF m_ForeColor; - FX_DWORD m_Flags; + uint32_t m_Flags; int m_Interpolation; - FX_DWORD m_AddFlags; + uint32_t m_AddFlags; IPDF_OCContext* m_pOCContext; - FX_DWORD m_dwLimitCacheSize; + uint32_t m_dwLimitCacheSize; int m_HalftoneLimit; }; diff --git a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h index 7c04e4a705..2d3ce44e46 100644 --- a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h +++ b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h @@ -42,7 +42,7 @@ class CPDF_TextRenderer { static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice, int nChars, - FX_DWORD* pCharCodes, + uint32_t* pCharCodes, FX_FLOAT* pCharPos, CPDF_Font* pFont, FX_FLOAT font_size, @@ -56,7 +56,7 @@ class CPDF_TextRenderer { static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice, int nChars, - FX_DWORD* pCharCodes, + uint32_t* pCharCodes, FX_FLOAT* pCharPos, CPDF_Font* pFont, FX_FLOAT font_size, @@ -66,7 +66,7 @@ class CPDF_TextRenderer { static FX_BOOL DrawType3Text(CFX_RenderDevice* pDevice, int nChars, - FX_DWORD* pCharCodes, + uint32_t* pCharCodes, FX_FLOAT* pCharPos, CPDF_Font* pFont, FX_FLOAT font_size, diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h index ea1b1d8f6b..a3b8d76fe7 100644 --- a/core/fpdfapi/fpdf_render/render_int.h +++ b/core/fpdfapi/fpdf_render/render_int.h @@ -56,7 +56,7 @@ class CPDF_Type3Glyphs { int& top_line, int& bottom_line); - std::map<FX_DWORD, CFX_GlyphBitmap*> m_GlyphMap; + std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap; int m_TopBlue[TYPE3_MAX_BLUES]; int m_BottomBlue[TYPE3_MAX_BLUES]; int m_TopBlueCount; @@ -67,14 +67,14 @@ class CPDF_Type3Cache { explicit CPDF_Type3Cache(CPDF_Type3Font* pFont) : m_pFont(pFont) {} ~CPDF_Type3Cache(); - CFX_GlyphBitmap* LoadGlyph(FX_DWORD charcode, + CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, const CFX_Matrix* pMatrix, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); protected: CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, - FX_DWORD charcode, + uint32_t charcode, const CFX_Matrix* pMatrix, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); @@ -148,7 +148,7 @@ class CPDF_RenderStatus { FX_BOOL bStdCS = FALSE, CPDF_Type3Char* pType3Char = NULL, FX_ARGB fill_color = 0, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE); void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder, const CFX_Matrix* pObj2Device); @@ -209,7 +209,7 @@ class CPDF_RenderStatus { int bitmap_alpha, const CFX_Matrix* pImage2Device, CPDF_ImageCacheEntry* pImageCache, - FX_DWORD flags); + uint32_t flags); void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int top, @@ -281,7 +281,7 @@ class CPDF_RenderStatus { int m_DitherBits; FX_BOOL m_bDropObjects; FX_BOOL m_bStdCS; - FX_DWORD m_GroupFamily; + uint32_t m_GroupFamily; FX_BOOL m_bLoadMask; CPDF_Type3Char* m_pType3Char; FX_ARGB m_T3FillColor; @@ -302,7 +302,7 @@ class CPDF_ImageLoader { CPDF_PageRenderCache* pCache, CPDF_ImageLoaderHandle*& LoadHandle, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, @@ -311,7 +311,7 @@ class CPDF_ImageLoader { CFX_DIBSource* m_pBitmap; CFX_DIBSource* m_pMask; - FX_DWORD m_MatteColor; + uint32_t m_MatteColor; FX_BOOL m_bCached; protected: @@ -327,7 +327,7 @@ class CPDF_ImageLoaderHandle { const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t nDownsampleWidth = 0, @@ -360,7 +360,7 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer { FX_ARGB bitmap_argb, int bitmap_alpha, const CFX_Matrix* pImage2Device, - FX_DWORD flags, + uint32_t flags, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL); @@ -377,7 +377,7 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer { FX_BOOL m_bPatternColor; CPDF_Pattern* m_pPattern; FX_ARGB m_FillArgb; - FX_DWORD m_Flags; + uint32_t m_Flags; CFX_ImageTransformer* m_pTransformer; void* m_DeviceHandle; CPDF_ImageLoaderHandle* m_LoadHandle; @@ -447,25 +447,25 @@ class CPDF_ImageCacheEntry { void Reset(const CFX_DIBitmap* pBitmap); FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, - FX_DWORD& MatteColor, + uint32_t& MatteColor, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); - FX_DWORD EstimateSize() const { return m_dwCacheSize; } - FX_DWORD GetTimeCount() const { return m_dwTimeCount; } + uint32_t EstimateSize() const { return m_dwCacheSize; } + uint32_t GetTimeCount() const { return m_dwTimeCount; } CPDF_Stream* GetStream() const { return m_pStream; } - void SetTimeCount(FX_DWORD dwTimeCount) { m_dwTimeCount = dwTimeCount; } + void SetTimeCount(uint32_t dwTimeCount) { m_dwTimeCount = dwTimeCount; } int m_dwTimeCount; public: int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, int32_t downsampleWidth = 0, @@ -475,7 +475,7 @@ class CPDF_ImageCacheEntry { CFX_DIBSource* DetachMask(); CFX_DIBSource* m_pCurBitmap; CFX_DIBSource* m_pCurMask; - FX_DWORD m_MatteColor; + uint32_t m_MatteColor; CPDF_RenderStatus* m_pRenderStatus; protected: @@ -485,7 +485,7 @@ class CPDF_ImageCacheEntry { CPDF_Stream* m_pStream; CFX_DIBSource* m_pCachedBitmap; CFX_DIBSource* m_pCachedMask; - FX_DWORD m_dwCacheSize; + uint32_t m_dwCacheSize; void CalcSize(); }; typedef struct { @@ -503,11 +503,11 @@ class CPDF_DIBSource : public CFX_DIBSource { FX_BOOL Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CPDF_DIBSource** ppMask, - FX_DWORD* pMatteColor, + uint32_t* pMatteColor, CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE); // CFX_DIBSource @@ -526,7 +526,7 @@ class CPDF_DIBSource : public CFX_DIBSource { CFX_DIBitmap* GetBitmap() const; void ReleaseBitmap(CFX_DIBitmap* pBitmap) const; void ClearImageData(); - FX_DWORD GetMatteColor() const { return m_MatteColor; } + uint32_t GetMatteColor() const { return m_MatteColor; } int StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, @@ -534,7 +534,7 @@ class CPDF_DIBSource : public CFX_DIBSource { CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, + uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE); int ContinueLoadDIBSource(IFX_Pause* pPause); int StratLoadMask(); @@ -548,7 +548,7 @@ class CPDF_DIBSource : public CFX_DIBSource { const CPDF_Dictionary* pPageResources); DIB_COMP_DATA* GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX_BOOL& bColorKey); - CPDF_DIBSource* LoadMask(FX_DWORD& MatteColor); + CPDF_DIBSource* LoadMask(uint32_t& MatteColor); CPDF_DIBSource* LoadMaskDIB(CPDF_Stream* pMask); void LoadJpxBitmap(); void LoadPalette(); @@ -558,7 +558,7 @@ class CPDF_DIBSource : public CFX_DIBSource { void ValidateDictParam(); void DownSampleScanline1Bit(int orig_Bpp, int dest_Bpp, - FX_DWORD src_width, + uint32_t src_width, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, @@ -567,7 +567,7 @@ class CPDF_DIBSource : public CFX_DIBSource { int clip_width) const; void DownSampleScanline8Bit(int orig_Bpp, int dest_Bpp, - FX_DWORD src_width, + uint32_t src_width, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, @@ -576,7 +576,7 @@ class CPDF_DIBSource : public CFX_DIBSource { int clip_width) const; void DownSampleScanline32Bit(int orig_Bpp, int dest_Bpp, - FX_DWORD src_width, + uint32_t src_width, const uint8_t* pSrcLine, uint8_t* dest_scan, int dest_width, @@ -590,12 +590,12 @@ class CPDF_DIBSource : public CFX_DIBSource { std::unique_ptr<CPDF_StreamAcc> m_pStreamAcc; const CPDF_Dictionary* m_pDict; CPDF_ColorSpace* m_pColorSpace; - FX_DWORD m_Family; - FX_DWORD m_bpc; - FX_DWORD m_bpc_orig; - FX_DWORD m_nComponents; - FX_DWORD m_GroupFamily; - FX_DWORD m_MatteColor; + uint32_t m_Family; + uint32_t m_bpc; + uint32_t m_bpc_orig; + uint32_t m_nComponents; + uint32_t m_GroupFamily; + uint32_t m_MatteColor; FX_BOOL m_bLoadMask; FX_BOOL m_bDefaultDecode; FX_BOOL m_bImageMask; diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index d0deb19a8c..ce37e1e9c9 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -100,7 +100,7 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const { } return csURI; } -FX_DWORD CPDF_ActionFields::GetFieldsCount() const { +uint32_t CPDF_ActionFields::GetFieldsCount() const { if (!m_pAction) { return 0; } @@ -147,8 +147,8 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const { if (pFields->IsDictionary() || pFields->IsString()) { fields.push_back(pFields); } else if (CPDF_Array* pArray = pFields->AsArray()) { - FX_DWORD iCount = pArray->GetCount(); - for (FX_DWORD i = 0; i < iCount; ++i) { + uint32_t iCount = pArray->GetCount(); + for (uint32_t i = 0; i < iCount; ++i) { CPDF_Object* pObj = pArray->GetElementValue(i); if (pObj) { fields.push_back(pObj); @@ -158,7 +158,7 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const { return fields; } -CPDF_Object* CPDF_ActionFields::GetField(FX_DWORD iIndex) const { +CPDF_Object* CPDF_ActionFields::GetField(uint32_t iIndex) const { if (!m_pAction) { return NULL; } @@ -232,7 +232,7 @@ int32_t CPDF_Action::GetOperationType() const { } return 0; } -FX_DWORD CPDF_Action::GetSubActionsCount() const { +uint32_t CPDF_Action::GetSubActionsCount() const { if (!m_pDict || !m_pDict->KeyExist("Next")) return 0; @@ -245,7 +245,7 @@ FX_DWORD CPDF_Action::GetSubActionsCount() const { return pArray->GetCount(); return 0; } -CPDF_Action CPDF_Action::GetSubAction(FX_DWORD iIndex) const { +CPDF_Action CPDF_Action::GetSubAction(uint32_t iIndex) const { if (!m_pDict || !m_pDict->KeyExist("Next")) { return CPDF_Action(); } diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp index 9a407482f1..e6e441f237 100644 --- a/core/fpdfdoc/doc_annot.cpp +++ b/core/fpdfdoc/doc_annot.cpp @@ -28,12 +28,12 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); FX_BOOL bRegenerateAP = pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances"); - for (FX_DWORD i = 0; i < pAnnots->GetCount(); ++i) { + for (uint32_t i = 0; i < pAnnots->GetCount(); ++i) { CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetElementValue(i)); if (!pDict) continue; - FX_DWORD dwObjNum = pDict->GetObjNum(); + uint32_t dwObjNum = pDict->GetObjNum(); if (dwObjNum == 0) { dwObjNum = m_pDocument->AddIndirectObject(pDict); CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum); @@ -67,7 +67,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) continue; - FX_DWORD annot_flags = pAnnot->GetFlags(); + uint32_t annot_flags = pAnnot->GetFlags(); if (annot_flags & ANNOTFLAG_HIDDEN) continue; @@ -110,7 +110,7 @@ void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage, CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_Matrix* pUser2Device, - FX_DWORD dwAnnotFlags, + uint32_t dwAnnotFlags, CPDF_RenderOptions* pOptions, FX_RECT* pClipRect) { if (dwAnnotFlags & 0x01) { @@ -148,7 +148,7 @@ void CPDF_Annot::GetRect(CFX_FloatRect& rect) const { rect.Normalize(); } -FX_DWORD CPDF_Annot::GetFlags() const { +uint32_t CPDF_Annot::GetFlags() const { return m_pAnnotDict->GetIntegerBy("F"); } @@ -259,7 +259,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, if (GetSubType() == "Popup") { return; } - FX_DWORD annot_flags = GetFlags(); + uint32_t annot_flags = GetFlags(); if (annot_flags & ANNOTFLAG_HIDDEN) { return; } @@ -311,7 +311,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, return; } CPDF_Array* pColor = m_pAnnotDict->GetArrayBy("C"); - FX_DWORD argb = 0xff000000; + uint32_t argb = 0xff000000; if (pColor) { int R = (int32_t)(pColor->GetNumberAt(0) * 255); int G = (int32_t)(pColor->GetNumberAt(1) * 255); @@ -322,13 +322,13 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, graph_state.m_LineWidth = width; if (style_char == 'D') { if (pDashArray) { - FX_DWORD dash_count = pDashArray->GetCount(); + uint32_t dash_count = pDashArray->GetCount(); if (dash_count % 2) { dash_count++; } graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count); graph_state.m_DashCount = dash_count; - FX_DWORD i; + uint32_t i; for (i = 0; i < pDashArray->GetCount(); ++i) { graph_state.m_DashArray[i] = pDashArray->GetNumberAt(i); } diff --git a/core/fpdfdoc/doc_ap.cpp b/core/fpdfdoc/doc_ap.cpp index 06e9da8c41..87edcd9836 100644 --- a/core/fpdfdoc/doc_ap.cpp +++ b/core/fpdfdoc/doc_ap.cpp @@ -26,7 +26,7 @@ FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { return FALSE; } CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString(); - FX_DWORD flags = FPDF_GetFieldAttr(pAnnotDict, "Ff") + uint32_t flags = FPDF_GetFieldAttr(pAnnotDict, "Ff") ? FPDF_GetFieldAttr(pAnnotDict, "Ff")->GetInteger() : 0; if (field_type == "Tx") { @@ -141,7 +141,7 @@ int32_t CPVT_Provider::GetCharWidth(int32_t nFontIndex, uint16_t word, int32_t nWordStyle) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { - FX_DWORD charcode = pPDFFont->CharCodeFromUnicode(word); + uint32_t charcode = pPDFFont->CharCodeFromUnicode(word); if (charcode != CPDF_Font::kInvalidCharCode) { return pPDFFont->GetCharWidthF(charcode); } @@ -204,7 +204,7 @@ static CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, pPDFFont->GetBaseFont().Compare("ZapfDingbats") == 0) { sWord.Format("%c", Word); } else { - FX_DWORD dwCharCode = pPDFFont->CharCodeFromUnicode(Word); + uint32_t dwCharCode = pPDFFont->CharCodeFromUnicode(Word); if (dwCharCode != CPDF_Font::kInvalidCharCode) { pPDFFont->AppendChar(sWord, dwCharCode); } @@ -462,10 +462,10 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q") ? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger() : 0; - FX_DWORD dwFlags = FPDF_GetFieldAttr(pAnnotDict, "Ff") + uint32_t dwFlags = FPDF_GetFieldAttr(pAnnotDict, "Ff") ? FPDF_GetFieldAttr(pAnnotDict, "Ff")->GetInteger() : 0; - FX_DWORD dwMaxLen = + uint32_t dwMaxLen = FPDF_GetFieldAttr(pAnnotDict, "MaxLen") ? FPDF_GetFieldAttr(pAnnotDict, "MaxLen")->GetInteger() : 0; @@ -625,7 +625,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, FX_BOOL bSelected = FALSE; if (pSels) { - for (FX_DWORD s = 0, ssz = pSels->GetCount(); s < ssz; s++) { + for (uint32_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) { if (i == pSels->GetIntegerAt(s)) { bSelected = TRUE; break; diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index cd2afab408..08d07e6c66 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -31,7 +31,7 @@ int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) { return 0; return pDoc->GetPageIndex(pPage->GetObjNum()); } -FX_DWORD CPDF_Dest::GetPageObjNum() { +uint32_t CPDF_Dest::GetPageObjNum() { CPDF_Array* pArray = ToArray(m_pObj); if (!pArray) return 0; @@ -101,8 +101,8 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, } CPDF_Array* pNames = pNode->GetArrayBy("Names"); if (pNames) { - FX_DWORD dwCount = pNames->GetCount() / 2; - for (FX_DWORD i = 0; i < dwCount; i++) { + uint32_t dwCount = pNames->GetCount() / 2; + for (uint32_t i = 0; i < dwCount; i++) { CFX_ByteString csValue = pNames->GetStringAt(i * 2); int32_t iCompare = csValue.Compare(csName); if (iCompare <= 0) { @@ -125,7 +125,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (!pKids) { return NULL; } - for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { + for (uint32_t i = 0; i < pKids->GetCount(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; @@ -164,7 +164,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, if (!pKids) { return NULL; } - for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { + for (uint32_t i = 0; i < pKids->GetCount(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; @@ -190,7 +190,7 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) { return 0; } int nCount = 0; - for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { + for (uint32_t i = 0; i < pKids->GetCount(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp index 6acd247df8..0ad7b5b70d 100644 --- a/core/fpdfdoc/doc_bookmark.cpp +++ b/core/fpdfdoc/doc_bookmark.cpp @@ -32,7 +32,7 @@ CPDF_Bookmark CPDF_BookmarkTree::GetNextSibling( return pNext == bookmark.GetDict() ? CPDF_Bookmark() : CPDF_Bookmark(pNext); } -FX_DWORD CPDF_Bookmark::GetColorRef() const { +uint32_t CPDF_Bookmark::GetColorRef() const { if (!m_pDict) { return 0; } @@ -45,7 +45,7 @@ FX_DWORD CPDF_Bookmark::GetColorRef() const { int b = FXSYS_round(pColor->GetNumberAt(2) * 255); return FXSYS_RGB(r, g, b); } -FX_DWORD CPDF_Bookmark::GetFontStyle() const { +uint32_t CPDF_Bookmark::GetFontStyle() const { if (!m_pDict) { return 0; } diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index eb70e2b38a..7642fac6bf 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -570,8 +570,8 @@ FX_BOOL CPDF_InterForm::ValidateFieldName( break; } } - FX_DWORD dwCount = m_pFieldTree->m_Root.CountFields(); - for (FX_DWORD m = 0; m < dwCount; m++) { + uint32_t dwCount = m_pFieldTree->m_Root.CountFields(); + for (uint32_t m = 0; m < dwCount; m++) { CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(m); if (!pField) { continue; @@ -669,14 +669,14 @@ int CPDF_InterForm::CompareFieldName(const CFX_WideString& name1, } return 0; } -FX_DWORD CPDF_InterForm::CountFields(const CFX_WideString& csFieldName) { +uint32_t CPDF_InterForm::CountFields(const CFX_WideString& csFieldName) { if (csFieldName.IsEmpty()) { - return (FX_DWORD)m_pFieldTree->m_Root.CountFields(); + return (uint32_t)m_pFieldTree->m_Root.CountFields(); } CFieldTree::_Node* pNode = m_pFieldTree->FindNode(csFieldName); return pNode ? pNode->CountFields() : 0; } -CPDF_FormField* CPDF_InterForm::GetField(FX_DWORD index, +CPDF_FormField* CPDF_InterForm::GetField(uint32_t index, const CFX_WideString& csFieldName) { if (csFieldName == L"") { return m_pFieldTree->m_Root.GetField(index); @@ -702,8 +702,8 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage, if (!pAnnotList) return nullptr; - for (FX_DWORD i = pAnnotList->GetCount(); i > 0; --i) { - FX_DWORD annot_index = i - 1; + for (uint32_t i = pAnnotList->GetCount(); i > 0; --i) { + uint32_t annot_index = i - 1; CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index); if (!pAnnot) continue; @@ -769,7 +769,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) { if (!pArray) { return -1; } - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { CPDF_Object* pElement = pArray->GetElementValue(i); if (pElement == pField->m_pDict) { return i; @@ -777,10 +777,10 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) { } return -1; } -FX_DWORD CPDF_InterForm::CountFormFonts() { +uint32_t CPDF_InterForm::CountFormFonts() { return CountInterFormFonts(m_pFormDict); } -CPDF_Font* CPDF_InterForm::GetFormFont(FX_DWORD index, +CPDF_Font* CPDF_InterForm::GetFormFont(uint32_t index, CFX_ByteString& csNameTag) { return GetInterFormFont(m_pFormDict, m_pDocument, index, csNameTag); } @@ -888,7 +888,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { if (!pFieldDict) { return; } - FX_DWORD dwParentObjNum = pFieldDict->GetObjNum(); + uint32_t dwParentObjNum = pFieldDict->GetObjNum(); CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (!pKids) { AddTerminalField(pFieldDict); @@ -899,7 +899,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { return; } if (pFirstKid->KeyExist("T") || pFirstKid->KeyExist("Kids")) { - for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { + for (uint32_t i = 0; i < pKids->GetCount(); i++) { CPDF_Dictionary* pChildDict = pKids->GetDictAt(i); if (pChildDict) { if (pChildDict->GetObjNum() != dwParentObjNum) { @@ -982,7 +982,7 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { AddControl(pField, pFieldDict); } } else { - for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { + for (uint32_t i = 0; i < pKids->GetCount(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; @@ -1022,7 +1022,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields( iType == CPDF_FormField::CheckBox || iType == CPDF_FormField::ListBox) { continue; } - FX_DWORD dwFlags = pField->GetFieldFlags(); + uint32_t dwFlags = pField->GetFieldFlags(); // TODO(thestig): Look up these magic numbers and add constants for them. if (dwFlags & 0x04) continue; @@ -1078,7 +1078,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( if (!pField || pField->GetType() == CPDF_FormField::PushButton) { continue; } - FX_DWORD dwFlags = pField->GetFieldFlags(); + uint32_t dwFlags = pField->GetFieldFlags(); if (dwFlags & 0x04) continue; @@ -1120,7 +1120,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, name += pFieldDict->GetUnicodeTextBy("T"); CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids"); if (pKids) { - for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { + for (uint32_t i = 0; i < pKids->GetCount(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; @@ -1192,7 +1192,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF, return FALSE; } } - for (FX_DWORD i = 0; i < pFields->GetCount(); i++) { + for (uint32_t i = 0; i < pFields->GetCount(); i++) { CPDF_Dictionary* pField = pFields->GetDictAt(i); if (!pField) { continue; diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp index 425c3a1ac3..255b5e9a70 100644 --- a/core/fpdfdoc/doc_formcontrol.cpp +++ b/core/fpdfdoc/doc_formcontrol.cpp @@ -349,7 +349,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, return 0; FX_ARGB color = 0; - FX_DWORD dwCount = pEntry->GetCount(); + uint32_t dwCount = pEntry->GetCount(); if (dwCount == 1) { iColorType = COLORTYPE_GRAY; FX_FLOAT g = pEntry->GetNumberAt(0) * 255; @@ -398,7 +398,7 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType, if (!pEntry) { return; } - FX_DWORD dwCount = pEntry->GetCount(); + uint32_t dwCount = pEntry->GetCount(); if (dwCount == 1) { iColorType = COLORTYPE_GRAY; fc[0] = pEntry->GetNumberAt(0); diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp index 6c3afad1ee..88d35d8a11 100644 --- a/core/fpdfdoc/doc_formfield.cpp +++ b/core/fpdfdoc/doc_formfield.cpp @@ -18,7 +18,7 @@ FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) { if (pField->GetType() == CPDF_FormField::CheckBox) { bUnison = TRUE; } else { - FX_DWORD dwFlags = pField->GetFieldFlags(); + uint32_t dwFlags = pField->GetFieldFlags(); bUnison = ((dwFlags & 0x2000000) != 0); } return bUnison; @@ -36,7 +36,7 @@ void CPDF_FormField::SyncFieldFlags() { CFX_ByteString type_name = FPDF_GetFieldAttr(m_pDict, "FT") ? FPDF_GetFieldAttr(m_pDict, "FT")->GetString() : CFX_ByteString(); - FX_DWORD flags = FPDF_GetFieldAttr(m_pDict, "Ff") + uint32_t flags = FPDF_GetFieldAttr(m_pDict, "Ff") ? FPDF_GetFieldAttr(m_pDict, "Ff")->GetInteger() : 0; m_Flags = 0; @@ -261,7 +261,7 @@ CFX_WideString CPDF_FormField::GetMappingName() { } return pObj->GetUnicodeText(); } -FX_DWORD CPDF_FormField::GetFieldFlags() { +uint32_t CPDF_FormField::GetFieldFlags() { CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "Ff"); if (!pObj) { return 0; @@ -537,7 +537,7 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) { break; } } - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) + for (uint32_t i = 0; i < pArray->GetCount(); i++) if (pArray->GetElementValue(i)->GetUnicodeText() == opt_value && (int)i == iPos) { return TRUE; diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp index b1a6a732ff..3f97024237 100644 --- a/core/fpdfdoc/doc_link.cpp +++ b/core/fpdfdoc/doc_link.cpp @@ -17,7 +17,7 @@ CPDF_LinkList::~CPDF_LinkList() {} const std::vector<CPDF_Dictionary*>* CPDF_LinkList::GetPageLinks( CPDF_Page* pPage) { - FX_DWORD objnum = pPage->m_pFormDict->GetObjNum(); + uint32_t objnum = pPage->m_pFormDict->GetObjNum(); if (objnum == 0) return nullptr; @@ -63,7 +63,7 @@ void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, if (!pAnnotList) return; - for (FX_DWORD i = 0; i < pAnnotList->GetCount(); ++i) { + for (uint32_t i = 0; i < pAnnotList->GetCount(); ++i) { CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i); bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link"); // Add non-links as nullptrs to preserve z-order. diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp index 8148b31a56..43ccc3fd8d 100644 --- a/core/fpdfdoc/doc_ocg.cpp +++ b/core/fpdfdoc/doc_ocg.cpp @@ -14,8 +14,8 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject, return -1; if (const CPDF_Array* pArray = pObject->AsArray()) { - FX_DWORD dwCount = pArray->GetCount(); - for (FX_DWORD i = 0; i < dwCount; i++) { + uint32_t dwCount = pArray->GetCount(); + for (uint32_t i = 0; i < dwCount; i++) { if (pArray->GetDictAt(i) == pGroupDict) return i; } @@ -32,8 +32,8 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict, } CFX_ByteString bsIntent; if (CPDF_Array* pArray = pIntent->AsArray()) { - FX_DWORD dwCount = pArray->GetCount(); - for (FX_DWORD i = 0; i < dwCount; i++) { + uint32_t dwCount = pArray->GetCount(); + for (uint32_t i = 0; i < dwCount; i++) { bsIntent = pArray->GetStringAt(i); if (bsIntent == "All" || bsIntent == csElement) return TRUE; diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index 1664aff761..868031401d 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -70,7 +70,7 @@ void CPDF_StructTreeImpl::LoadDocTree() { if (!pArray) return; - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { CPDF_Dictionary* pKid = pArray->GetDictAt(i); CPDF_StructElementImpl* pStructElementImpl = new CPDF_StructElementImpl(this, nullptr, pKid); @@ -86,7 +86,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) { if (!pKids) return; - FX_DWORD dwKids = 0; + uint32_t dwKids = 0; if (pKids->IsDictionary()) dwKids = 1; else if (CPDF_Array* pArray = pKids->AsArray()) @@ -94,7 +94,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) { else return; - FX_DWORD i; + uint32_t i; m_Kids.SetSize(dwKids); for (i = 0; i < dwKids; i++) { m_Kids[i] = NULL; @@ -178,7 +178,7 @@ FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict, } } if (CPDF_Array* pTopKids = pObj->AsArray()) { - FX_DWORD i; + uint32_t i; FX_BOOL bSave = FALSE; for (i = 0; i < pTopKids->GetCount(); i++) { CPDF_Reference* pKidRef = ToReference(pTopKids->GetElement(i)); @@ -232,7 +232,7 @@ void CPDF_StructElementImpl::Release() { } void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) { CPDF_Object* pObj = pDict->GetElement("Pg"); - FX_DWORD PageObjNum = 0; + uint32_t PageObjNum = 0; if (CPDF_Reference* pRef = ToReference(pObj)) PageObjNum = pRef->GetRefObjNum(); @@ -242,7 +242,7 @@ void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) { if (CPDF_Array* pArray = pKids->AsArray()) { m_Kids.SetSize(pArray->GetCount()); - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { CPDF_Object* pKid = pArray->GetElementValue(i); LoadKid(PageObjNum, pKid, &m_Kids[i]); } @@ -251,7 +251,7 @@ void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) { LoadKid(PageObjNum, pKids, &m_Kids[0]); } } -void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum, +void CPDF_StructElementImpl::LoadKid(uint32_t PageObjNum, CPDF_Object* pKidObj, CPDF_StructKid* pKid) { pKid->m_Type = CPDF_StructKid::Invalid; @@ -324,7 +324,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs, } else if (CPDF_Stream* pStream = pAttrs->AsStream()) { pDict = pStream->GetDict(); } else if (CPDF_Array* pArray = pAttrs->AsArray()) { - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { CPDF_Object* pElement = pArray->GetElementValue(i); pDict = FindAttrDict(pElement, owner, nLevel + 1); if (pDict) @@ -371,7 +371,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, return nullptr; if (CPDF_Array* pArray = pC->AsArray()) { - for (FX_DWORD i = 0; i < pArray->GetCount(); i++) { + for (uint32_t i = 0; i < pArray->GetCount(); i++) { CFX_ByteString class_name = pArray->GetStringAt(i); CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name); if (pClassDict && pClassDict->GetStringBy("O") == owner) diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index 8659a621b2..e2e3e13e8c 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -27,8 +27,8 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { } CPDF_Array* pNumbers = pNode->GetArrayBy("Nums"); if (pNumbers) { - FX_DWORD dwCount = pNumbers->GetCount() / 2; - for (FX_DWORD i = 0; i < dwCount; i++) { + uint32_t dwCount = pNumbers->GetCount() / 2; + for (uint32_t i = 0; i < dwCount; i++) { int index = pNumbers->GetIntegerAt(i * 2); if (num == index) { return pNumbers->GetElementValue(i * 2 + 1); @@ -43,7 +43,7 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { if (!pKids) { return NULL; } - for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { + for (uint32_t i = 0; i < pKids->GetCount(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) { continue; @@ -274,7 +274,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { } if (!pFormDict) { pFormDict = new CPDF_Dictionary; - FX_DWORD dwObjNum = pDocument->AddIndirectObject(pFormDict); + uint32_t dwObjNum = pDocument->AddIndirectObject(pFormDict); CPDF_Dictionary* pRoot = pDocument->GetRoot(); pRoot->SetAtReference("AcroForm", pDocument, dwObjNum); } @@ -311,7 +311,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { pFormDict->SetAtString("DA", csDA); } } -FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { +uint32_t CountInterFormFonts(CPDF_Dictionary* pFormDict) { if (!pFormDict) { return 0; } @@ -323,7 +323,7 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { if (!pFonts) { return 0; } - FX_DWORD dwCount = 0; + uint32_t dwCount = 0; for (const auto& it : *pFonts) { CPDF_Object* pObj = it.second; if (!pObj) { @@ -339,7 +339,7 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) { } CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, - FX_DWORD index, + uint32_t index, CFX_ByteString& csNameTag) { if (!pFormDict) { return NULL; @@ -352,7 +352,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFonts) { return NULL; } - FX_DWORD dwCount = 0; + uint32_t dwCount = 0; for (const auto& it : *pFonts) { const CFX_ByteString& csKey = it.first; CPDF_Object* pObj = it.second; @@ -708,7 +708,7 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { } CPDF_Array* pA = m_pDict->GetArrayBy("A"); if (pA) { - FX_DWORD dwCount = pA->GetCount(); + uint32_t dwCount = pA->GetCount(); if (dwCount > 0) { fLeft = pA->GetNumberAt(0); } diff --git a/core/fpdfdoc/doc_utils.h b/core/fpdfdoc/doc_utils.h index e9a11e075f..35b7d2d598 100644 --- a/core/fpdfdoc/doc_utils.h +++ b/core/fpdfdoc/doc_utils.h @@ -25,10 +25,10 @@ class CPDF_NumberTree { CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument); -FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict); +uint32_t CountInterFormFonts(CPDF_Dictionary* pFormDict); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, - FX_DWORD index, + uint32_t index, CFX_ByteString& csNameTag); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, diff --git a/core/fpdfdoc/doc_vt.cpp b/core/fpdfdoc/doc_vt.cpp index 5ccba85b72..028a2204c5 100644 --- a/core/fpdfdoc/doc_vt.cpp +++ b/core/fpdfdoc/doc_vt.cpp @@ -423,11 +423,11 @@ static bool IsLatin(uint16_t word) { (word >= 0xFF41 && word <= 0xFF5A)); } -static bool IsDigit(FX_DWORD word) { +static bool IsDigit(uint32_t word) { return word >= 0x0030 && word <= 0x0039; } -static bool IsCJK(FX_DWORD word) { +static bool IsCJK(uint32_t word) { if ((word >= 0x1100 && word <= 0x11FF) || (word >= 0x2E80 && word <= 0x2FFF) || (word >= 0x3040 && word <= 0x9FBF) || @@ -448,7 +448,7 @@ static bool IsCJK(FX_DWORD word) { return word >= 0xFF66 && word <= 0xFF9D; } -static bool IsPunctuation(FX_DWORD word) { +static bool IsPunctuation(uint32_t word) { if (word <= 0x007F) return !!(special_chars[word] & 0x08); @@ -495,11 +495,11 @@ static bool IsPunctuation(FX_DWORD word) { return false; } -static bool IsConnectiveSymbol(FX_DWORD word) { +static bool IsConnectiveSymbol(uint32_t word) { return word <= 0x007F && (special_chars[word] & 0x20); } -static bool IsOpenStylePunctuation(FX_DWORD word) { +static bool IsOpenStylePunctuation(uint32_t word) { if (word <= 0x007F) return !!(special_chars[word] & 0x04); diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h index e930f613b1..4877069bf6 100644 --- a/core/fpdfdoc/tagged_int.h +++ b/core/fpdfdoc/tagged_int.h @@ -82,7 +82,7 @@ class CPDF_StructElementImpl final : public CPDF_StructElement { int subindex = -1) override; void LoadKids(CPDF_Dictionary* pDict); - void LoadKid(FX_DWORD PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid); + void LoadKid(uint32_t PageObjNum, CPDF_Object* pObj, CPDF_StructKid* pKid); CPDF_Object* GetAttr(const CFX_ByteStringC& owner, const CFX_ByteStringC& name, FX_BOOL bInheritable, diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp index 34f17fbb3a..349a2cd752 100644 --- a/core/fpdftext/fpdf_text_int.cpp +++ b/core/fpdftext/fpdf_text_int.cpp @@ -80,7 +80,7 @@ FX_FLOAT _CalculateBaseSpace(const CPDF_TextObject* pTextObj, for (int i = 0; i < nItems; i++) { CPDF_TextObjectItem item; pTextObj->GetItemInfo(i, &item); - if (item.m_CharCode == (FX_DWORD)-1) { + if (item.m_CharCode == (uint32_t)-1) { FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH(); FX_FLOAT kerning = -fontsize_h * item.m_OriginX / 1000; baseSpace = std::min(baseSpace, kerning + spacing); @@ -897,7 +897,7 @@ void CPDF_TextPage::ProcessFormObject(CPDF_FormObject* pFormObj, } } -int CPDF_TextPage::GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const { +int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const { if (charCode == -1) return 0; @@ -1267,7 +1267,7 @@ FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, for (int32_t i = 0; i < nItems; i++) { CPDF_TextObjectItem item; pTextObj->GetItemInfo(i, &item); - if (item.m_CharCode == (FX_DWORD)-1) { + if (item.m_CharCode == (uint32_t)-1) { continue; } CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode); @@ -1393,7 +1393,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { charinfo.m_OriginX = 0; charinfo.m_OriginY = 0; pTextObj->GetItemInfo(i, &item); - if (item.m_CharCode == (FX_DWORD)-1) { + if (item.m_CharCode == (uint32_t)-1) { CFX_WideString str = m_TempTextBuf.GetWideString(); if (str.IsEmpty()) { str = m_TextBuf.GetWideString(); @@ -1415,7 +1415,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { if (spacing && i > 0) { int last_width = 0; FX_FLOAT fontsize_h = pTextObj->m_TextState.GetFontSizeH(); - FX_DWORD space_charcode = pFont->CharCodeFromUnicode(' '); + uint32_t space_charcode = pFont->CharCodeFromUnicode(' '); FX_FLOAT threshold = 0; if (space_charcode != -1) { threshold = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000; @@ -1448,7 +1448,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { charinfo.m_OriginX, charinfo.m_OriginY); m_TempCharList.push_back(charinfo); } - if (item.m_CharCode == (FX_DWORD)-1) { + if (item.m_CharCode == (uint32_t)-1) { continue; } } @@ -1861,7 +1861,7 @@ FX_BOOL CPDF_TextPage::GenerateCharInfo(FX_WCHAR unicode, PAGECHAR_INFO& info) { info.m_CharCode = -1; info.m_Flag = FPDFTEXT_CHAR_GENERATED; int preWidth = 0; - if (preChar->m_pTextObj && preChar->m_CharCode != (FX_DWORD)-1) + if (preChar->m_pTextObj && preChar->m_CharCode != (uint32_t)-1) preWidth = GetCharWidth(preChar->m_CharCode, preChar->m_pTextObj->GetFont()); diff --git a/core/fpdftext/fpdf_text_int.h b/core/fpdftext/fpdf_text_int.h index a4274d7aed..7acab55ccb 100644 --- a/core/fpdftext/fpdf_text_int.h +++ b/core/fpdftext/fpdf_text_int.h @@ -122,7 +122,7 @@ class CPDF_TextPage : public IPDF_TextPage { CPDF_PageObjectList::const_iterator ObjPos); FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1, CPDF_TextObject* pTextObj2); - int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const; + int GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const; void CloseTempLine(); void OnPiece(CFX_BidiChar* pBidi, CFX_WideString& str); int32_t PreMarkedContent(PDFTEXT_Obj pObj); diff --git a/core/fxcodec/codec/codec_int.h b/core/fxcodec/codec/codec_int.h index d19a694222..c7bd9fc6fe 100644 --- a/core/fxcodec/codec/codec_int.h +++ b/core/fxcodec/codec/codec_int.h @@ -26,15 +26,15 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: // ICodec_BasicModule: FX_BOOL RunLengthEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) override; + uint32_t& dest_size) override; FX_BOOL A85Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) override; + uint32_t& dest_size) override; ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -60,7 +60,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { protected: class ImageDataCache { public: - ImageDataCache(int width, int height, FX_DWORD pitch); + ImageDataCache(int width, int height, uint32_t pitch); ~ImageDataCache(); bool AllocateCache(); @@ -77,7 +77,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { const int m_Width; const int m_Height; - const FX_DWORD m_Pitch; + const uint32_t m_Pitch; int m_nCachedLines; std::unique_ptr<uint8_t, FxFreeDeleter> m_Data; }; @@ -95,7 +95,7 @@ class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { int m_OutputHeight; int m_nComps; int m_bpc; - FX_DWORD m_Pitch; + uint32_t m_Pitch; FX_BOOL m_bColorTransformed; int m_NextLine; uint8_t* m_pLastScanline; @@ -106,7 +106,7 @@ class CCodec_FaxModule : public ICodec_FaxModule { public: // ICodec_FaxModule: ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, @@ -120,13 +120,13 @@ class CCodec_FaxModule : public ICodec_FaxModule { int height, int pitch, uint8_t*& dest_buf, - FX_DWORD& dest_size) override; + uint32_t& dest_size) override; }; class CCodec_FlateModule : public ICodec_FlateModule { public: virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -135,60 +135,60 @@ class CCodec_FlateModule : public ICodec_FlateModule { int Colors, int BitsPerComponent, int Columns); - virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, + virtual uint32_t FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, + uint32_t estimated_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); virtual FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); virtual FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size); + uint32_t& dest_size); }; class CCodec_JpegModule : public ICodec_JpegModule { public: CCodec_JpegModule() {} ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, FX_BOOL ColorTransform) override; FX_BOOL LoadInfo(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, - FX_DWORD* icc_length) override; + uint32_t* icc_length) override; FX_BOOL Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, - FX_DWORD icc_length) override; + uint32_t icc_length) override; void* Start() override; void Finish(void* pContext) override; void Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) override; + uint32_t src_size) override; #ifndef PDF_ENABLE_XFA int ReadHeader(void* pContext, int* width, int* height, int* nComps) override; #else // PDF_ENABLE_XFA @@ -200,7 +200,7 @@ class CCodec_JpegModule : public ICodec_JpegModule { #endif // PDF_ENABLE_XFA int StartScanline(void* pContext, int down_scale) override; FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override; - FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; + uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; }; #ifdef PDF_ENABLE_XFA @@ -213,7 +213,7 @@ class CCodec_PngModule : public ICodec_PngModule { virtual void Finish(void* pContext); virtual FX_BOOL Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_DIBAttribute* pAttribute); protected: @@ -224,8 +224,8 @@ class CCodec_GifModule : public ICodec_GifModule { CCodec_GifModule() { FXSYS_memset(m_szLastError, '\0', 256); } virtual void* Start(void* pModule); virtual void Finish(void* pContext); - virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); - virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); + virtual uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); + virtual void Input(void* pContext, const uint8_t* src_buf, uint32_t src_size); virtual int32_t ReadHeader(void* pContext, int* width, @@ -249,17 +249,17 @@ class CCodec_BmpModule : public ICodec_BmpModule { CCodec_BmpModule() { FXSYS_memset(m_szLastError, 0, sizeof(m_szLastError)); } void* Start(void* pModule) override; void Finish(void* pContext) override; - FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; + uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; void Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) override; + uint32_t src_size) override; int32_t ReadHeader(void* pContext, int32_t* width, int32_t* height, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, - FX_DWORD** pal_pp, + uint32_t** pal_pp, CFX_DIBAttribute* pAttribute) override; int32_t LoadImage(void* pContext) override; @@ -279,25 +279,25 @@ class CCodec_IccModule : public ICodec_IccModule { void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam = NULL, - FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, - FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, - FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, - FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override; + uint32_t dwIntent = Icc_INTENT_PERCEPTUAL, + uint32_t dwFlag = Icc_FLAGS_DEFAULT, + uint32_t dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, + uint32_t dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override; void* CreateTransform_sRGB( const uint8_t* pProfileData, - FX_DWORD dwProfileSize, - FX_DWORD& nComponents, + uint32_t dwProfileSize, + uint32_t& nComponents, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) override; + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT) override; void* CreateTransform_CMYK( const uint8_t* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - FX_DWORD& nSrcComponents, + uint32_t dwSrcProfileSize, + uint32_t& nSrcComponents, const uint8_t* pDstProfileData, - FX_DWORD dwDstProfileSize, + uint32_t dwDstProfileSize, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, - FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) override; + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT, + uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) override; void DestroyTransform(void* pTransform) override; void Translate(void* pTransform, FX_FLOAT* pSrcValues, @@ -306,7 +306,7 @@ class CCodec_IccModule : public ICodec_IccModule { uint8_t* pDest, const uint8_t* pSrc, int pixels) override; - void SetComponents(FX_DWORD nComponents) override { + void SetComponents(uint32_t nComponents) override { m_nComponents = nComponents; } @@ -321,7 +321,7 @@ class CCodec_IccModule : public ICodec_IccModule { Icc_CLASS ic, CFX_BinaryBuf* pTransformKey); - FX_DWORD m_nComponents; + uint32_t m_nComponents; std::map<CFX_ByteString, CFX_IccTransformCache*> m_MapTranform; std::map<CFX_ByteString, CFX_IccProfileCache*> m_MapProfile; }; @@ -333,12 +333,12 @@ class CCodec_JpxModule : public ICodec_JpxModule { // ICodec_JpxModule: CJPX_Decoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CPDF_ColorSpace* cs) override; void GetImageInfo(CJPX_Decoder* pDecoder, - FX_DWORD* width, - FX_DWORD* height, - FX_DWORD* components) override; + uint32_t* width, + uint32_t* height, + uint32_t* components) override; bool Decode(CJPX_Decoder* pDecoder, uint8_t* dest_data, int pitch, @@ -354,10 +354,10 @@ class CCodec_TiffModule : public ICodec_TiffModule { void GetFrames(void* ctx, int32_t& frames) override; FX_BOOL LoadFrameInfo(void* ctx, int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute) override; FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) override; void DestroyDecoder(void* ctx) override; @@ -372,12 +372,12 @@ class CCodec_Jbig2Context { CCodec_Jbig2Context(); ~CCodec_Jbig2Context() {} - FX_DWORD m_width; - FX_DWORD m_height; + uint32_t m_width; + uint32_t m_height; CPDF_StreamAcc* m_pGlobalStream; CPDF_StreamAcc* m_pSrcStream; uint8_t* m_dest_buf; - FX_DWORD m_dest_pitch; + uint32_t m_dest_pitch; IFX_Pause* m_pPause; CJBig2_Context* m_pContext; CJBig2_Image* m_dest_image; @@ -391,12 +391,12 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module { void* CreateJbig2Context() override; FXCODEC_STATUS StartDecode(void* pJbig2Context, CFX_PrivateData* pPrivateData, - FX_DWORD width, - FX_DWORD height, + uint32_t width, + uint32_t height, CPDF_StreamAcc* src_stream, CPDF_StreamAcc* global_stream, uint8_t* dest_buf, - FX_DWORD dest_pitch, + uint32_t dest_pitch, IFX_Pause* pPause) override; FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause) override; diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index 92dba69acf..0952c809ac 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -32,7 +32,7 @@ CCodec_ModuleMgr::CCodec_ModuleMgr() CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width, int height, - FX_DWORD pitch) + uint32_t pitch) : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) {} CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() {} @@ -147,9 +147,9 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) { } FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { return FALSE; } @@ -256,9 +256,9 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) { #undef EXPONENT_DETECT FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { return FALSE; } @@ -287,7 +287,7 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { ~CCodec_RLScanlineDecoder() override; FX_BOOL Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -297,7 +297,7 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override {} FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override { return m_SrcOffset; } + uint32_t GetSrcOffset() override { return m_SrcOffset; } protected: FX_BOOL CheckDestSize(); @@ -306,9 +306,9 @@ class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { uint8_t* m_pScanline; const uint8_t* m_pSrcBuf; - FX_DWORD m_SrcSize; - FX_DWORD m_dwLineBytes; - FX_DWORD m_SrcOffset; + uint32_t m_SrcSize; + uint32_t m_dwLineBytes; + uint32_t m_SrcOffset; FX_BOOL m_bEOD; uint8_t m_Operator; }; @@ -324,9 +324,9 @@ CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() { FX_Free(m_pScanline); } FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() { - FX_DWORD i = 0; - FX_DWORD old_size = 0; - FX_DWORD dest_size = 0; + uint32_t i = 0; + uint32_t old_size = 0; + uint32_t dest_size = 0; while (i < m_SrcSize) { if (m_pSrcBuf[i] < 128) { old_size = dest_size; @@ -346,14 +346,14 @@ FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() { break; } } - if (((FX_DWORD)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 > + if (((uint32_t)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 > dest_size) { return FALSE; } return TRUE; } FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -378,7 +378,7 @@ FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, } m_Pitch = pitch.ValueOrDie(); // Overflow should already have been checked before this is called. - m_dwLineBytes = (static_cast<FX_DWORD>(width) * nComps * bpc + 7) / 8; + m_dwLineBytes = (static_cast<uint32_t>(width) * nComps * bpc + 7) / 8; m_pScanline = FX_Alloc(uint8_t, m_Pitch); return CheckDestSize(); } @@ -398,11 +398,11 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { } } FXSYS_memset(m_pScanline, 0, m_Pitch); - FX_DWORD col_pos = 0; + uint32_t col_pos = 0; FX_BOOL eol = FALSE; while (m_SrcOffset < m_SrcSize && !eol) { if (m_Operator < 128) { - FX_DWORD copy_len = m_Operator + 1; + uint32_t copy_len = m_Operator + 1; if (col_pos + copy_len >= m_dwLineBytes) { copy_len = m_dwLineBytes - col_pos; eol = TRUE; @@ -419,7 +419,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { if (m_SrcOffset - 1 < m_SrcSize - 1) { fill = m_pSrcBuf[m_SrcOffset]; } - FX_DWORD duplicate_len = 257 - m_Operator; + uint32_t duplicate_len = 257 - m_Operator; if (col_pos + duplicate_len >= m_dwLineBytes) { duplicate_len = m_dwLineBytes - col_pos; eol = TRUE; @@ -447,7 +447,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { return; } if (m_Operator < 128) { - FXSYS_assert((FX_DWORD)m_Operator + 1 >= used_bytes); + FXSYS_assert((uint32_t)m_Operator + 1 >= used_bytes); if (used_bytes == m_Operator + 1) { m_SrcOffset += used_bytes; GetNextOperator(); @@ -461,7 +461,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { return; } uint8_t count = 257 - m_Operator; - FXSYS_assert((FX_DWORD)count >= used_bytes); + FXSYS_assert((uint32_t)count >= used_bytes); if (used_bytes == count) { m_SrcOffset++; GetNextOperator(); @@ -472,7 +472,7 @@ void CCodec_RLScanlineDecoder::UpdateOperator(uint8_t used_bytes) { } ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, diff --git a/core/fxcodec/codec/fx_codec_bmp.cpp b/core/fxcodec/codec/fx_codec_bmp.cpp index d2299d6e56..31383774aa 100644 --- a/core/fxcodec/codec/fx_codec_bmp.cpp +++ b/core/fxcodec/codec/fx_codec_bmp.cpp @@ -37,7 +37,7 @@ static void bmp_read_scanline(bmp_decompress_struct_p bmp_ptr, pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf); } static FX_BOOL bmp_get_data_position(bmp_decompress_struct_p bmp_ptr, - FX_DWORD rcd_pos) { + uint32_t rcd_pos) { FXBMP_Context* p = (FXBMP_Context*)bmp_ptr->context_ptr; CCodec_BmpModule* pModule = (CCodec_BmpModule*)p->parent_ptr; return pModule->InputImagePositionBufCallback(p->child_ptr, rcd_pos); @@ -81,7 +81,7 @@ int32_t CCodec_BmpModule::ReadHeader(void* pContext, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, - FX_DWORD** pal_pp, + uint32_t** pal_pp, CFX_DIBAttribute* pAttribute) { FXBMP_Context* p = (FXBMP_Context*)pContext; if (setjmp(p->bmp_ptr->jmpbuf)) { @@ -112,14 +112,14 @@ int32_t CCodec_BmpModule::LoadImage(void* pContext) { } return bmp_decode_image(p->bmp_ptr); } -FX_DWORD CCodec_BmpModule::GetAvailInput(void* pContext, +uint32_t CCodec_BmpModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr) { FXBMP_Context* p = (FXBMP_Context*)pContext; return bmp_get_avail_input(p->bmp_ptr, avial_buf_ptr); } void CCodec_BmpModule::Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { FXBMP_Context* p = (FXBMP_Context*)pContext; bmp_input_buffer(p->bmp_ptr, (uint8_t*)src_buf, src_size); } diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 13ffcda174..0ccebba14e 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -257,7 +257,7 @@ int FaxGetRun(const uint8_t* ins_array, const uint8_t* src_buf, int& bitpos, int bitsize) { - FX_DWORD code = 0; + uint32_t code = 0; int ins_off = 0; while (1) { uint8_t ins = ins_array[ins_off++]; @@ -602,7 +602,7 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder { ~CCodec_FaxDecoder() override; FX_BOOL Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, @@ -616,12 +616,12 @@ class CCodec_FaxDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override {} FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override; + uint32_t GetSrcOffset() override; int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; int bitpos; const uint8_t* m_pSrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pScanlineBuf; uint8_t* m_pRefBuf; }; @@ -635,7 +635,7 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder() { FX_Free(m_pRefBuf); } FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, @@ -657,7 +657,7 @@ FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, m_OrigHeight = height; } // Should not overflow. Checked by FPDFAPI_CreateFaxDecoder. - m_Pitch = (static_cast<FX_DWORD>(m_OrigWidth) + 31) / 32 * 4; + m_Pitch = (static_cast<uint32_t>(m_OrigWidth) + 31) / 32 * 4; m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); @@ -717,14 +717,14 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() { } } if (m_bBlack) { - for (FX_DWORD i = 0; i < m_Pitch; i++) { + for (uint32_t i = 0; i < m_Pitch; i++) { m_pScanlineBuf[i] = ~m_pScanlineBuf[i]; } } return m_pScanlineBuf; } -FX_DWORD CCodec_FaxDecoder::GetSrcOffset() { - FX_DWORD ret = (bitpos + 7) / 8; +uint32_t CCodec_FaxDecoder::GetSrcOffset() { + uint32_t ret = (bitpos + 7) / 8; if (ret > m_SrcSize) { ret = m_SrcSize; } @@ -732,7 +732,7 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset() { } void FaxG4Decode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int* pbitpos, uint8_t* dest_buf, int width, @@ -758,7 +758,7 @@ class CCodec_FaxEncoder { public: CCodec_FaxEncoder(const uint8_t* src_buf, int width, int height, int pitch); ~CCodec_FaxEncoder(); - void Encode(uint8_t*& dest_buf, FX_DWORD& dest_size); + void Encode(uint8_t*& dest_buf, uint32_t& dest_size); void Encode2DLine(const uint8_t* scan_line); CFX_BinaryBuf m_DestBuf; uint8_t* m_pRefLine; @@ -783,7 +783,7 @@ CCodec_FaxEncoder::~CCodec_FaxEncoder() { FX_Free(m_pRefLine); FX_Free(m_pLineBuf); } -void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) { +void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, uint32_t& dest_size) { int dest_bitpos = 0; uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i++) { @@ -807,14 +807,14 @@ FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, int height, int pitch, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { CCodec_FaxEncoder encoder(src_buf, width, height, pitch); encoder.Encode(dest_buf, dest_size); return TRUE; } ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index d4ad241a4d..e69c017ee7 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -83,27 +83,27 @@ namespace { class CLZWDecoder { public: int Decode(uint8_t* output, - FX_DWORD& outlen, + uint32_t& outlen, const uint8_t* input, - FX_DWORD& size, + uint32_t& size, FX_BOOL bEarlyChange); private: - void AddCode(FX_DWORD prefix_code, uint8_t append_char); - void DecodeString(FX_DWORD code); + void AddCode(uint32_t prefix_code, uint8_t append_char); + void DecodeString(uint32_t code); - FX_DWORD m_InPos; - FX_DWORD m_OutPos; + uint32_t m_InPos; + uint32_t m_OutPos; uint8_t* m_pOutput; const uint8_t* m_pInput; FX_BOOL m_Early; - FX_DWORD m_CodeArray[5021]; - FX_DWORD m_nCodes; + uint32_t m_CodeArray[5021]; + uint32_t m_nCodes; uint8_t m_DecodeStack[4000]; - FX_DWORD m_StackLen; + uint32_t m_StackLen; int m_CodeLen; }; -void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { +void CLZWDecoder::AddCode(uint32_t prefix_code, uint8_t append_char) { if (m_nCodes + m_Early == 4094) { return; } @@ -116,13 +116,13 @@ void CLZWDecoder::AddCode(FX_DWORD prefix_code, uint8_t append_char) { m_CodeLen = 12; } } -void CLZWDecoder::DecodeString(FX_DWORD code) { +void CLZWDecoder::DecodeString(uint32_t code) { while (1) { int index = code - 258; if (index < 0 || index >= (int)m_nCodes) { break; } - FX_DWORD data = m_CodeArray[index]; + uint32_t data = m_CodeArray[index]; if (m_StackLen >= sizeof(m_DecodeStack)) { return; } @@ -135,9 +135,9 @@ void CLZWDecoder::DecodeString(FX_DWORD code) { m_DecodeStack[m_StackLen++] = (uint8_t)code; } int CLZWDecoder::Decode(uint8_t* dest_buf, - FX_DWORD& dest_size, + uint32_t& dest_size, const uint8_t* src_buf, - FX_DWORD& src_size, + uint32_t& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -146,7 +146,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, m_pOutput = dest_buf; m_Early = bEarlyChange ? 1 : 0; m_nCodes = 0; - FX_DWORD old_code = (FX_DWORD)-1; + uint32_t old_code = (uint32_t)-1; uint8_t last_char = 0; while (1) { if (m_InPos + m_CodeLen > src_size * 8) { @@ -154,7 +154,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, } int byte_pos = m_InPos / 8; int bit_pos = m_InPos % 8, bit_left = m_CodeLen; - FX_DWORD code = 0; + uint32_t code = 0; if (bit_pos) { bit_left -= 8 - bit_pos; code = (m_pInput[byte_pos++] & ((1 << (8 - bit_pos)) - 1)) << bit_left; @@ -178,18 +178,18 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, } m_OutPos++; last_char = (uint8_t)code; - if (old_code != (FX_DWORD)-1) { + if (old_code != (uint32_t)-1) { AddCode(old_code, last_char); } old_code = code; } else if (code == 256) { m_CodeLen = 9; m_nCodes = 0; - old_code = (FX_DWORD)-1; + old_code = (uint32_t)-1; } else if (code == 257) { break; } else { - if (old_code == (FX_DWORD)-1) { + if (old_code == (uint32_t)-1) { return 2; } m_StackLen = 0; @@ -205,7 +205,7 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, return -5; } if (m_pOutput) { - for (FX_DWORD i = 0; i < m_StackLen; i++) { + for (uint32_t i = 0; i < m_StackLen; i++) { m_pOutput[m_OutPos + i] = m_DecodeStack[m_StackLen - i - 1]; } } @@ -243,7 +243,7 @@ uint8_t PaethPredictor(int a, int b, int c) { } FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int predictor, int Colors, int BitsPerComponent, @@ -400,7 +400,7 @@ void PNG_PredictLine(uint8_t* pDestData, } FX_BOOL PNG_Predictor(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int Colors, int BitsPerComponent, int Columns) { @@ -540,7 +540,7 @@ void TIFF_PredictorEncodeLine(uint8_t* dest_buf, } FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int Colors, int BitsPerComponent, int Columns) { @@ -561,7 +561,7 @@ FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, } void TIFF_PredictLine(uint8_t* dest_buf, - FX_DWORD row_size, + uint32_t row_size, int BitsPerComponent, int Colors, int Columns) { @@ -586,7 +586,7 @@ void TIFF_PredictLine(uint8_t* dest_buf, } int BytesPerPixel = BitsPerComponent * Colors / 8; if (BitsPerComponent == 16) { - for (FX_DWORD i = BytesPerPixel; i < row_size; i += 2) { + for (uint32_t i = BytesPerPixel; i < row_size; i += 2) { uint16_t pixel = (dest_buf[i - BytesPerPixel] << 8) | dest_buf[i - BytesPerPixel + 1]; pixel += (dest_buf[i] << 8) | dest_buf[i + 1]; @@ -594,14 +594,14 @@ void TIFF_PredictLine(uint8_t* dest_buf, dest_buf[i + 1] = (uint8_t)pixel; } } else { - for (FX_DWORD i = BytesPerPixel; i < row_size; i++) { + for (uint32_t i = BytesPerPixel; i < row_size; i++) { dest_buf[i] += dest_buf[i - BytesPerPixel]; } } } FX_BOOL TIFF_Predictor(uint8_t*& data_buf, - FX_DWORD& data_size, + uint32_t& data_size, int Colors, int BitsPerComponent, int Columns) { @@ -621,21 +621,21 @@ FX_BOOL TIFF_Predictor(uint8_t*& data_buf, } void FlateUncompress(const uint8_t* src_buf, - FX_DWORD src_size, - FX_DWORD orig_size, + uint32_t src_size, + uint32_t orig_size, uint8_t*& dest_buf, - FX_DWORD& dest_size, - FX_DWORD& offset) { - FX_DWORD guess_size = orig_size ? orig_size : src_size * 2; - const FX_DWORD kStepSize = 10240; - FX_DWORD alloc_step = orig_size ? kStepSize : std::min(src_size, kStepSize); - static const FX_DWORD kMaxInitialAllocSize = 10000000; + uint32_t& dest_size, + uint32_t& offset) { + uint32_t guess_size = orig_size ? orig_size : src_size * 2; + const uint32_t kStepSize = 10240; + uint32_t alloc_step = orig_size ? kStepSize : std::min(src_size, kStepSize); + static const uint32_t kMaxInitialAllocSize = 10000000; if (guess_size > kMaxInitialAllocSize) { guess_size = kMaxInitialAllocSize; alloc_step = kMaxInitialAllocSize; } - FX_DWORD buf_size = guess_size; - FX_DWORD last_buf_size = buf_size; + uint32_t buf_size = guess_size; + uint32_t last_buf_size = buf_size; dest_buf = nullptr; dest_size = 0; @@ -660,7 +660,7 @@ void FlateUncompress(const uint8_t* src_buf, if (avail_buf_size != 0) break; - FX_DWORD old_size = guess_size; + uint32_t old_size = guess_size; guess_size += alloc_step; if (guess_size < old_size || guess_size + 1 < guess_size) { FPDFAPI_FlateEnd(context); @@ -715,10 +715,10 @@ void FlateUncompress(const uint8_t* src_buf, dest_buf = result_tmp_bufs[0]; } else { uint8_t* result_buf = FX_Alloc(uint8_t, dest_size); - FX_DWORD result_pos = 0; + uint32_t result_pos = 0; for (int32_t i = 0; i < result_tmp_bufs.GetSize(); i++) { uint8_t* tmp_buf = result_tmp_bufs[i]; - FX_DWORD tmp_buf_size = buf_size; + uint32_t tmp_buf_size = buf_size; if (i == result_tmp_bufs.GetSize() - 1) { tmp_buf_size = last_buf_size; } @@ -740,7 +740,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder { ~CCodec_FlateScanlineDecoder() override; void Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -755,11 +755,11 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override {} FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override; + uint32_t GetSrcOffset() override; void* m_pFlate; const uint8_t* m_SrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pScanline; uint8_t* m_pLastLine; uint8_t* m_pPredictBuffer; @@ -768,7 +768,7 @@ class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder { int m_Colors; int m_BitsPerComponent; int m_Columns; - FX_DWORD m_PredictPitch; + uint32_t m_PredictPitch; size_t m_LeftOver; }; @@ -790,7 +790,7 @@ CCodec_FlateScanlineDecoder::~CCodec_FlateScanlineDecoder() { } } void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -806,7 +806,7 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, m_nComps = nComps; m_bpc = bpc; m_bColorTransformed = FALSE; - m_Pitch = (static_cast<FX_DWORD>(width) * nComps * bpc + 7) / 8; + m_Pitch = (static_cast<uint32_t>(width) * nComps * bpc + 7) / 8; m_pScanline = FX_Alloc(uint8_t, m_Pitch); m_Predictor = 0; if (predictor) { @@ -825,7 +825,7 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, m_BitsPerComponent = BitsPerComponent; m_Columns = Columns; m_PredictPitch = - (static_cast<FX_DWORD>(m_BitsPerComponent) * m_Colors * m_Columns + + (static_cast<uint32_t>(m_BitsPerComponent) * m_Colors * m_Columns + 7) / 8; m_pLastLine = FX_Alloc(uint8_t, m_PredictPitch); @@ -894,13 +894,13 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { } return m_pScanline; } -FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset() { +uint32_t CCodec_FlateScanlineDecoder::GetSrcOffset() { return FPDFAPI_FlateGetTotalIn(m_pFlate); } ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -914,19 +914,19 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder( Colors, BitsPerComponent, Columns); return pDecoder; } -FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, +uint32_t CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, + uint32_t estimated_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { dest_buf = NULL; - FX_DWORD offset = 0; + uint32_t offset = 0; int predictor_type = 0; if (predictor) { if (predictor >= 10) { @@ -938,11 +938,11 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, if (bLZW) { { std::unique_ptr<CLZWDecoder> decoder(new CLZWDecoder); - dest_size = (FX_DWORD)-1; + dest_size = (uint32_t)-1; offset = src_size; int err = decoder->Decode(NULL, dest_size, src_buf, offset, bEarlyChange); if (err || dest_size == 0 || dest_size + 1 < dest_size) { - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } } { @@ -965,16 +965,16 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, ret = TIFF_Predictor(dest_buf, dest_size, Colors, BitsPerComponent, Columns); } - return ret ? offset : static_cast<FX_DWORD>(-1); + return ret ? offset : static_cast<uint32_t>(-1); } FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { if (predictor != 2 && predictor < 10) { return Encode(src_buf, src_size, dest_buf, dest_size); } @@ -995,13 +995,13 @@ FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, return ret; } FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { dest_size = src_size + src_size / 1000 + 12; dest_buf = FX_Alloc(uint8_t, dest_size); unsigned long temp_size = dest_size; FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); - dest_size = (FX_DWORD)temp_size; + dest_size = (uint32_t)temp_size; return TRUE; } diff --git a/core/fxcodec/codec/fx_codec_gif.cpp b/core/fxcodec/codec/fx_codec_gif.cpp index 60ca00f9fa..1657d7257e 100644 --- a/core/fxcodec/codec/fx_codec_gif.cpp +++ b/core/fxcodec/codec/fx_codec_gif.cpp @@ -37,7 +37,7 @@ static uint8_t* gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, p->child_ptr, gif_get_frame_num(gif_ptr), pal_size); } static void gif_record_current_position(gif_decompress_struct_p gif_ptr, - FX_DWORD* cur_pos_ptr) { + uint32_t* cur_pos_ptr) { FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr); @@ -50,7 +50,7 @@ static void gif_read_scanline(gif_decompress_struct_p gif_ptr, pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf); } static FX_BOOL gif_get_record_position(gif_decompress_struct_p gif_ptr, - FX_DWORD cur_pos, + uint32_t cur_pos, int32_t left, int32_t top, int32_t width, @@ -155,7 +155,7 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, if (p->gif_ptr->cmt_data_ptr) { const uint8_t* buf = (const uint8_t*)p->gif_ptr->cmt_data_ptr->GetBuffer(0); - FX_DWORD len = p->gif_ptr->cmt_data_ptr->GetLength(); + uint32_t len = p->gif_ptr->cmt_data_ptr->GetLength(); if (len > 21) { uint8_t size = *buf++; if (size) { @@ -174,14 +174,14 @@ int32_t CCodec_GifModule::LoadFrame(void* pContext, } return ret; } -FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext, +uint32_t CCodec_GifModule::GetAvailInput(void* pContext, uint8_t** avial_buf_ptr) { FXGIF_Context* p = (FXGIF_Context*)pContext; return gif_get_avail_input(p->gif_ptr, avial_buf_ptr); } void CCodec_GifModule::Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { FXGIF_Context* p = (FXGIF_Context*)pContext; gif_input_buffer(p->gif_ptr, (uint8_t*)src_buf, src_size); } diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp index fc8113e4e6..13280d7f49 100644 --- a/core/fxcodec/codec/fx_codec_icc.cpp +++ b/core/fxcodec/codec/fx_codec_icc.cpp @@ -8,13 +8,13 @@ #include "core/include/fxcodec/fx_codec.h" #include "third_party/lcms2-2.6/include/lcms2.h" -const FX_DWORD N_COMPONENT_LAB = 3; -const FX_DWORD N_COMPONENT_GRAY = 1; -const FX_DWORD N_COMPONENT_RGB = 3; -const FX_DWORD N_COMPONENT_CMYK = 4; -const FX_DWORD N_COMPONENT_DEFAULT = 3; +const uint32_t N_COMPONENT_LAB = 3; +const uint32_t N_COMPONENT_GRAY = 1; +const uint32_t N_COMPONENT_RGB = 3; +const uint32_t N_COMPONENT_CMYK = 4; +const uint32_t N_COMPONENT_DEFAULT = 3; -FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]) { +FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]) { return cmsMD5computeIDExt(buf, dwSize, ID); } struct CLcmsCmm { @@ -67,8 +67,8 @@ FX_BOOL CheckComponents(cmsColorSpaceSignature cs, return TRUE; } -FX_DWORD GetCSComponents(cmsColorSpaceSignature cs) { - FX_DWORD components; +uint32_t GetCSComponents(cmsColorSpaceSignature cs) { + uint32_t components; switch (cs) { case cmsSigLabData: components = N_COMPONENT_LAB; @@ -90,14 +90,14 @@ FX_DWORD GetCSComponents(cmsColorSpaceSignature cs) { } void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - FX_DWORD& nSrcComponents, + uint32_t dwSrcProfileSize, + uint32_t& nSrcComponents, const unsigned char* pDstProfileData, - FX_DWORD dwDstProfileSize, + uint32_t dwDstProfileSize, int32_t nDstComponents, int intent, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, - FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) { + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT, + uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) { cmsHPROFILE srcProfile = NULL; cmsHPROFILE dstProfile = NULL; cmsHTRANSFORM hTransform = NULL; @@ -170,10 +170,10 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, return pCmm; } void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, - FX_DWORD dwProfileSize, - FX_DWORD& nComponents, + uint32_t dwProfileSize, + uint32_t& nComponents, int32_t intent, - FX_DWORD dwSrcFormat) { + uint32_t dwSrcFormat) { return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL, 0, 3, intent, dwSrcFormat); } @@ -185,7 +185,7 @@ void IccLib_DestroyTransform(void* pTransform) { delete (CLcmsCmm*)pTransform; } void IccLib_Translate(void* pTransform, - FX_DWORD nSrcComponents, + uint32_t nSrcComponents, FX_FLOAT* pSrcValues, FX_FLOAT* pDestValues) { if (!pTransform) { @@ -196,14 +196,14 @@ void IccLib_Translate(void* pTransform, if (p->m_bLab) { CFX_FixedBufGrow<double, 16> inputs(nSrcComponents); double* input = inputs; - for (FX_DWORD i = 0; i < nSrcComponents; i++) { + for (uint32_t i = 0; i < nSrcComponents; i++) { input[i] = pSrcValues[i]; } cmsDoTransform(p->m_hTransform, input, output, 1); } else { CFX_FixedBufGrow<uint8_t, 16> inputs(nSrcComponents); uint8_t* input = inputs; - for (FX_DWORD i = 0; i < nSrcComponents; i++) { + for (uint32_t i = 0; i < nSrcComponents; i++) { if (pSrcValues[i] > 1.0f) { input[i] = 255; } else if (pSrcValues[i] < 0) { @@ -284,7 +284,7 @@ ICodec_IccModule::IccCS GetProfileCSFromHandle(void* pProfile) { } ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS( const uint8_t* pProfileData, - FX_DWORD dwProfileSize) { + uint32_t dwProfileSize) { ICodec_IccModule::IccCS cs; cmsHPROFILE hProfile = cmsOpenProfileFromMem((void*)pProfileData, dwProfileSize); @@ -302,14 +302,14 @@ ICodec_IccModule::IccCS CCodec_IccModule::GetProfileCS(IFX_FileRead* pFile) { return IccCS_Unknown; } ICodec_IccModule::IccCS cs; - FX_DWORD dwSize = (FX_DWORD)pFile->GetSize(); + uint32_t dwSize = (uint32_t)pFile->GetSize(); uint8_t* pBuf = FX_Alloc(uint8_t, dwSize); pFile->ReadBlock(pBuf, 0, dwSize); cs = GetProfileCS(pBuf, dwSize); FX_Free(pBuf); return cs; } -FX_DWORD TransferProfileType(void* pProfile, FX_DWORD dwFormat) { +uint32_t TransferProfileType(void* pProfile, uint32_t dwFormat) { cmsColorSpaceSignature cs = cmsGetColorSpace(pProfile); switch (cs) { case cmsSigXYZData: @@ -359,7 +359,7 @@ class CFX_IccProfileCache { CFX_IccProfileCache(); ~CFX_IccProfileCache(); void* m_pProfile; - FX_DWORD m_dwRate; + uint32_t m_dwRate; protected: void Purge(); @@ -379,7 +379,7 @@ class CFX_IccTransformCache { CFX_IccTransformCache(CLcmsCmm* pCmm = NULL); ~CFX_IccTransformCache(); void* m_pIccTransform; - FX_DWORD m_dwRate; + uint32_t m_dwRate; CLcmsCmm* m_pCmm; protected: @@ -400,10 +400,10 @@ void CFX_IccTransformCache::Purge() {} class CFX_ByteStringKey : public CFX_BinaryBuf { public: CFX_ByteStringKey() : CFX_BinaryBuf() {} - CFX_ByteStringKey& operator<<(FX_DWORD i); + CFX_ByteStringKey& operator<<(uint32_t i); }; -CFX_ByteStringKey& CFX_ByteStringKey::operator<<(FX_DWORD i) { - AppendBlock(&i, sizeof(FX_DWORD)); +CFX_ByteStringKey& CFX_ByteStringKey::operator<<(uint32_t i) { + AppendBlock(&i, sizeof(uint32_t)); return *this; } void* CCodec_IccModule::CreateProfile(ICodec_IccModule::IccParam* pIccParam, @@ -472,10 +472,10 @@ void* CCodec_IccModule::CreateTransform( ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam, - FX_DWORD dwIntent, - FX_DWORD dwFlag, - FX_DWORD dwPrfIntent, - FX_DWORD dwPrfFlag) { + uint32_t dwIntent, + uint32_t dwFlag, + uint32_t dwPrfIntent, + uint32_t dwPrfFlag) { CLcmsCmm* pCmm = NULL; ASSERT(pInputParam && pOutputParam); CFX_ByteStringKey key; @@ -487,9 +487,9 @@ void* CCodec_IccModule::CreateTransform( if (!pOutputProfile) { return NULL; } - FX_DWORD dwInputProfileType = + uint32_t dwInputProfileType = TransferProfileType(pInputProfile, pInputParam->dwFormat); - FX_DWORD dwOutputProfileType = + uint32_t dwOutputProfileType = TransferProfileType(pOutputProfile, pOutputParam->dwFormat); if (dwInputProfileType == 0 || dwOutputProfileType == 0) { return NULL; @@ -537,22 +537,22 @@ CCodec_IccModule::~CCodec_IccModule() { m_MapTranform.clear(); } void* CCodec_IccModule::CreateTransform_sRGB(const uint8_t* pProfileData, - FX_DWORD dwProfileSize, - FX_DWORD& nComponents, + uint32_t dwProfileSize, + uint32_t& nComponents, int32_t intent, - FX_DWORD dwSrcFormat) { + uint32_t dwSrcFormat) { return IccLib_CreateTransform_sRGB(pProfileData, dwProfileSize, nComponents, intent, dwSrcFormat); } void* CCodec_IccModule::CreateTransform_CMYK(const uint8_t* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - FX_DWORD& nSrcComponents, + uint32_t dwSrcProfileSize, + uint32_t& nSrcComponents, const uint8_t* pDstProfileData, - FX_DWORD dwDstProfileSize, + uint32_t dwDstProfileSize, int32_t intent, - FX_DWORD dwSrcFormat, - FX_DWORD dwDstFormat) { + uint32_t dwSrcFormat, + uint32_t dwDstFormat) { return IccLib_CreateTransform( pSrcProfileData, dwSrcProfileSize, nSrcComponents, pDstProfileData, dwDstProfileSize, 4, intent, dwSrcFormat, dwDstFormat); diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 557d246ca4..ddcec6c6bb 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -58,12 +58,12 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) { } FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, CFX_PrivateData* pPrivateData, - FX_DWORD width, - FX_DWORD height, + uint32_t width, + uint32_t height, CPDF_StreamAcc* src_stream, CPDF_StreamAcc* global_stream, uint8_t* dest_buf, - FX_DWORD dest_pitch, + uint32_t dest_pitch, IFX_Pause* pPause) { if (!pJbig2Context) { return FXCODEC_STATUS_ERR_PARAMS; @@ -95,7 +95,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, return FXCODEC_STATUS_ERROR; } int dword_size = height * dest_pitch / 4; - FX_DWORD* dword_buf = (FX_DWORD*)dest_buf; + uint32_t* dword_buf = (uint32_t*)dest_buf; for (int i = 0; i < dword_size; i++) { dword_buf[i] = ~dword_buf[i]; } @@ -118,7 +118,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context, } int dword_size = m_pJbig2Context->m_height * m_pJbig2Context->m_dest_pitch / 4; - FX_DWORD* dword_buf = (FX_DWORD*)m_pJbig2Context->m_dest_buf; + uint32_t* dword_buf = (uint32_t*)m_pJbig2Context->m_dest_buf; for (int i = 0; i < dword_size; i++) { dword_buf[i] = ~dword_buf[i]; } diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index 1b0dff7499..a81926e053 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -23,11 +23,11 @@ extern "C" { } extern "C" { -static void _JpegScanSOI(const uint8_t*& src_buf, FX_DWORD& src_size) { +static void _JpegScanSOI(const uint8_t*& src_buf, uint32_t& src_size) { if (src_size == 0) { return; } - FX_DWORD offset = 0; + uint32_t offset = 0; while (offset < src_size - 1) { if (src_buf[offset] == 0xff && src_buf[offset + 1] == 0xd8) { src_buf += offset; @@ -81,16 +81,16 @@ static void _error_do_nothing2(j_common_ptr cinfo, char*) {} #define JPEG_OVERHEAD_LEN 14 static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, - FX_DWORD icc_length) { + uint32_t icc_length) { if (!icc_buf_ptr || icc_length == 0) { return FALSE; } - FX_DWORD icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN); - FX_DWORD icc_segment_num = (icc_length / icc_segment_size) + 1; + uint32_t icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN); + uint32_t icc_segment_num = (icc_length / icc_segment_size) + 1; if (icc_segment_num > 255) { return FALSE; } - FX_DWORD icc_data_length = + uint32_t icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length); uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length); FXSYS_memcpy(icc_data, "\x49\x43\x43\x5f\x50\x52\x4f\x46\x49\x4c\x45\x00", @@ -103,7 +103,7 @@ static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, icc_data_length); } icc_data[12] = (uint8_t)icc_segment_num; - FX_DWORD icc_size = (icc_segment_num - 1) * icc_segment_size; + uint32_t icc_size = (icc_segment_num - 1) * icc_segment_size; FXSYS_memcpy(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, @@ -125,7 +125,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, - FX_DWORD icc_length) { + uint32_t icc_length) { struct jpeg_error_mgr jerr; jerr.error_exit = _error_do_nothing; jerr.emit_message = _error_do_nothing1; @@ -138,10 +138,10 @@ static void _JpegEncode(const CFX_DIBSource* pSource, cinfo.err = &jerr; jpeg_create_compress(&cinfo); int Bpp = pSource->GetBPP() / 8; - FX_DWORD nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1; - FX_DWORD pitch = pSource->GetPitch(); - FX_DWORD width = pdfium::base::checked_cast<FX_DWORD>(pSource->GetWidth()); - FX_DWORD height = pdfium::base::checked_cast<FX_DWORD>(pSource->GetHeight()); + uint32_t nComponents = Bpp >= 3 ? (pSource->IsCmykImage() ? 4 : 3) : 1; + uint32_t pitch = pSource->GetPitch(); + uint32_t width = pdfium::base::checked_cast<uint32_t>(pSource->GetWidth()); + uint32_t height = pdfium::base::checked_cast<uint32_t>(pSource->GetHeight()); FX_SAFE_DWORD safe_buf_len = width; safe_buf_len *= height; safe_buf_len *= nComponents; @@ -150,7 +150,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, safe_buf_len += 255 * 18; safe_buf_len += icc_length; } - FX_DWORD dest_buf_length = 0; + uint32_t dest_buf_length = 0; if (!safe_buf_len.IsValid()) { dest_buf = nullptr; } else { @@ -199,7 +199,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, if (nComponents > 1) { uint8_t* dest_scan = line_buf; if (nComponents == 3) { - for (FX_DWORD i = 0; i < width; i++) { + for (uint32_t i = 0; i < width; i++) { dest_scan[0] = src_scan[2]; dest_scan[1] = src_scan[1]; dest_scan[2] = src_scan[0]; @@ -207,7 +207,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource, src_scan += Bpp; } } else { - for (FX_DWORD i = 0; i < pitch; i++) { + for (uint32_t i = 0; i < pitch; i++) { *dest_scan++ = ~*src_scan++; } } @@ -246,14 +246,14 @@ static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo, #endif // PDF_ENABLE_XFA static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, - FX_DWORD* icc_length) { + uint32_t* icc_length) { _JpegScanSOI(src_buf, src_size); struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; @@ -313,7 +313,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { ~CCodec_JpegDecoder() override; FX_BOOL Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -324,7 +324,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { void v_DownScale(int dest_width, int dest_height) override; FX_BOOL v_Rewind() override; uint8_t* v_GetNextLine() override; - FX_DWORD GetSrcOffset() override; + uint32_t GetSrcOffset() override; FX_BOOL InitDecode(); @@ -333,7 +333,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { struct jpeg_error_mgr jerr; struct jpeg_source_mgr src; const uint8_t* m_SrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pScanlineBuf; FX_BOOL m_bInited; @@ -341,7 +341,7 @@ class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { FX_BOOL m_bJpegTransform; protected: - FX_DWORD m_nDefaultScaleDenom; + uint32_t m_nDefaultScaleDenom; }; CCodec_JpegDecoder::CCodec_JpegDecoder() { @@ -396,7 +396,7 @@ FX_BOOL CCodec_JpegDecoder::InitDecode() { return TRUE; } FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -432,7 +432,7 @@ FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, return FALSE; } m_Pitch = - (static_cast<FX_DWORD>(cinfo.image_width) * cinfo.num_components + 3) / + (static_cast<uint32_t>(cinfo.image_width) * cinfo.num_components + 3) / 4 * 4; m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); m_nComps = cinfo.num_components; @@ -467,7 +467,7 @@ void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) { FX_GetDownsampleRatio(m_OrigWidth, m_OrigHeight, dest_width, dest_height); m_OutputWidth = (m_OrigWidth + m_DownScale - 1) / m_DownScale; m_OutputHeight = (m_OrigHeight + m_DownScale - 1) / m_DownScale; - m_Pitch = (static_cast<FX_DWORD>(m_OutputWidth) * m_nComps + 3) / 4 * 4; + m_Pitch = (static_cast<uint32_t>(m_OutputWidth) * m_nComps + 3) / 4 * 4; if (old_scale != m_DownScale) { m_NextLine = -1; } @@ -506,12 +506,12 @@ uint8_t* CCodec_JpegDecoder::v_GetNextLine() { } return m_pScanlineBuf; } -FX_DWORD CCodec_JpegDecoder::GetSrcOffset() { - return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); +uint32_t CCodec_JpegDecoder::GetSrcOffset() { + return (uint32_t)(m_SrcSize - src.bytes_in_buffer); } ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -528,14 +528,14 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder( return pDecoder; } FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, - FX_DWORD* icc_length) { + uint32_t* icc_length) { return _JpegLoadInfo(src_buf, src_size, width, height, num_components, bits_per_components, color_transform, icc_buf_ptr, icc_length); @@ -545,7 +545,7 @@ FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, - FX_DWORD icc_length) { + uint32_t icc_length) { if (pSource->GetBPP() < 8 || pSource->GetPalette()) return FALSE; @@ -615,7 +615,7 @@ void CCodec_JpegModule::Finish(void* pContext) { } void CCodec_JpegModule::Input(void* pContext, const unsigned char* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { FXJPEG_Context* p = (FXJPEG_Context*)pContext; if (p->m_SkipSize) { if (p->m_SkipSize > src_size) { @@ -679,7 +679,7 @@ FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1); return nlines == 1; } -FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, +uint32_t CCodec_JpegModule::GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) { if (avail_buf_ptr) { *avail_buf_ptr = NULL; @@ -688,5 +688,5 @@ FX_DWORD CCodec_JpegModule::GetAvailInput(void* pContext, (uint8_t*)((FXJPEG_Context*)pContext)->m_SrcMgr.next_input_byte; } } - return (FX_DWORD)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; + return (uint32_t)((FXJPEG_Context*)pContext)->m_SrcMgr.bytes_in_buffer; } diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp index 99eb78f9f1..27b645c137 100644 --- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -675,15 +675,15 @@ class CJPX_Decoder { public: explicit CJPX_Decoder(CPDF_ColorSpace* cs); ~CJPX_Decoder(); - FX_BOOL Init(const unsigned char* src_data, FX_DWORD src_size); - void GetInfo(FX_DWORD* width, FX_DWORD* height, FX_DWORD* components); + FX_BOOL Init(const unsigned char* src_data, uint32_t src_size); + void GetInfo(uint32_t* width, uint32_t* height, uint32_t* components); bool Decode(uint8_t* dest_buf, int pitch, const std::vector<uint8_t>& offsets); private: const uint8_t* m_SrcData; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; opj_image_t* image; opj_codec_t* l_codec; opj_stream_t* l_stream; @@ -705,7 +705,7 @@ CJPX_Decoder::~CJPX_Decoder() { } } -FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX_DWORD src_size) { +FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) { static const unsigned char szJP2Header[] = { 0x00, 0x00, 0x00, 0x0c, 0x6a, 0x50, 0x20, 0x20, 0x0d, 0x0a, 0x87, 0x0a}; if (!src_data || src_size < sizeof(szJP2Header)) @@ -788,12 +788,12 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX_DWORD src_size) { return TRUE; } -void CJPX_Decoder::GetInfo(FX_DWORD* width, - FX_DWORD* height, - FX_DWORD* components) { - *width = (FX_DWORD)image->x1; - *height = (FX_DWORD)image->y1; - *components = (FX_DWORD)image->numcomps; +void CJPX_Decoder::GetInfo(uint32_t* width, + uint32_t* height, + uint32_t* components) { + *width = (uint32_t)image->x1; + *height = (uint32_t)image->y1; + *components = (uint32_t)image->numcomps; } bool CJPX_Decoder::Decode(uint8_t* dest_buf, @@ -874,16 +874,16 @@ CCodec_JpxModule::CCodec_JpxModule() {} CCodec_JpxModule::~CCodec_JpxModule() {} CJPX_Decoder* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CPDF_ColorSpace* cs) { std::unique_ptr<CJPX_Decoder> decoder(new CJPX_Decoder(cs)); return decoder->Init(src_buf, src_size) ? decoder.release() : nullptr; } void CCodec_JpxModule::GetImageInfo(CJPX_Decoder* pDecoder, - FX_DWORD* width, - FX_DWORD* height, - FX_DWORD* components) { + uint32_t* width, + uint32_t* height, + uint32_t* components) { pDecoder->GetInfo(width, height, components); } diff --git a/core/fxcodec/codec/fx_codec_png.cpp b/core/fxcodec/codec/fx_codec_png.cpp index a3882ba8fb..f8621001b6 100644 --- a/core/fxcodec/codec/fx_codec_png.cpp +++ b/core/fxcodec/codec/fx_codec_png.cpp @@ -239,7 +239,7 @@ void CCodec_PngModule::Finish(void* pContext) { } FX_BOOL CCodec_PngModule::Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_DIBAttribute* pAttribute) { FXPNG_Context* p = (FXPNG_Context*)pContext; if (setjmp(png_jmpbuf(p->png_ptr))) { diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index b22d20339b..9e113c695c 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -296,12 +296,12 @@ CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() { FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData( ICodec_JpegModule* pJpegModule, FXCODEC_STATUS& err_status) { - FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize(); + uint32_t dwSize = (uint32_t)m_pFile->GetSize(); if (dwSize <= m_offSet) { return FALSE; } dwSize = dwSize - m_offSet; - FX_DWORD dwAvail = pJpegModule->GetAvailInput(m_pJpegContext, NULL); + uint32_t dwAvail = pJpegModule->GetAvailInput(m_pJpegContext, NULL); if (dwAvail == m_SrcSize) { if (dwSize > FXCODEC_BLOCK_SIZE) { dwSize = FXCODEC_BLOCK_SIZE; @@ -314,7 +314,7 @@ FX_BOOL CCodec_ProgressiveDecoder::JpegReadMoreData( return FALSE; } } else { - FX_DWORD dwConsume = m_SrcSize - dwAvail; + uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } @@ -417,13 +417,13 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, if (pDIBitmap->GetPalette()) { return FALSE; } - FX_DWORD des_g = 0; + uint32_t des_g = 0; des_g += pPixelWeights->m_Weights[0] * src_scan[src_col]; des_scan[pPixelWeights->m_SrcStart] = (uint8_t)(des_g >> 16); } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; const uint8_t* p = src_scan + src_col * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); des_g += pPixelWeights->m_Weights[0] * (*p++); @@ -434,7 +434,7 @@ FX_BOOL CCodec_ProgressiveDecoder::PngAskScanlineBufFunc(void* pModule, *pDes = (uint8_t)((des_r) >> 16); } break; case FXDIB_Argb: { - FX_DWORD des_r = 0, des_g = 0, des_b = 0; + uint32_t des_r = 0, des_g = 0, des_b = 0; const uint8_t* p = src_scan + src_col * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); des_g += pPixelWeights->m_Weights[0] * (*p++); @@ -476,7 +476,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( if (pDeviceBitmap->GetPalette()) { return; } - FX_DWORD des_g = 0; + uint32_t des_g = 0; des_g += pPixelWeights->m_Weights[0] * src_scan[pPixelWeights->m_SrcStart]; des_g += @@ -485,7 +485,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; const uint8_t* p = src_scan; p = src_scan + pPixelWeights->m_SrcStart * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); @@ -501,7 +501,7 @@ void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz( des_scan += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; const uint8_t* p = src_scan; p = src_scan + pPixelWeights->m_SrcStart * src_Bpp; des_b += pPixelWeights->m_Weights[0] * (*p++); @@ -554,12 +554,12 @@ void CCodec_ProgressiveDecoder::PngFillScanlineBufCompletedFunc(void* pModule, } FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, FXCODEC_STATUS& err_status) { - FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize(); + uint32_t dwSize = (uint32_t)m_pFile->GetSize(); if (dwSize <= m_offSet) { return FALSE; } dwSize = dwSize - m_offSet; - FX_DWORD dwAvail = pGifModule->GetAvailInput(m_pGifContext, NULL); + uint32_t dwAvail = pGifModule->GetAvailInput(m_pGifContext, NULL); if (dwAvail == m_SrcSize) { if (dwSize > FXCODEC_BLOCK_SIZE) { dwSize = FXCODEC_BLOCK_SIZE; @@ -572,7 +572,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, return FALSE; } } else { - FX_DWORD dwConsume = m_SrcSize - dwAvail; + uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } @@ -590,9 +590,9 @@ FX_BOOL CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, } void CCodec_ProgressiveDecoder::GifRecordCurrentPositionCallback( void* pModule, - FX_DWORD& cur_pos) { + uint32_t& cur_pos) { CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule; - FX_DWORD remain_size = + uint32_t remain_size = pCodec->m_pCodecMgr->GetGifModule()->GetAvailInput(pCodec->m_pGifContext); cur_pos = pCodec->m_offSet - remain_size; } @@ -604,7 +604,7 @@ uint8_t* CCodec_ProgressiveDecoder::GifAskLocalPaletteBufCallback( } FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback( void* pModule, - FX_DWORD rcd_pos, + uint32_t rcd_pos, const FX_RECT& img_rc, int32_t pal_num, void* pal_ptr, @@ -637,7 +637,7 @@ FX_BOOL CCodec_ProgressiveDecoder::GifInputRecordPositionBufCallback( } pCodec->m_SrcPaletteNumber = pal_num; for (int i = 0; i < pal_num; i++) { - FX_DWORD j = i * 3; + uint32_t j = i * 3; pCodec->m_pSrcPalette[i] = ArgbEncode(0xff, pPalette[j], pPalette[j + 1], pPalette[j + 2]); } @@ -738,7 +738,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, if (scale_y > 1.0) { int des_bottom = des_top + pCodec->m_sizeY; int des_Bpp = pDIBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = pCodec->m_startX * des_Bpp; + uint32_t des_ScanOffet = pCodec->m_startX * des_Bpp; if (des_row + (int)scale_y >= des_bottom - 1) { uint8_t* scan_src = (uint8_t*)pDIBitmap->GetScanline(des_row) + des_ScanOffet; @@ -746,7 +746,7 @@ void CCodec_ProgressiveDecoder::GifReadScanlineCallback(void* pModule, while (++cur_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDIBitmap->GetScanline(cur_row) + des_ScanOffet; - FX_DWORD size = pCodec->m_sizeX * des_Bpp; + uint32_t size = pCodec->m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -761,7 +761,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = m_startX * des_Bpp; + uint32_t des_ScanOffet = m_startX * des_Bpp; int des_top = m_startY; int des_row_1 = des_row - int(2 * scale_y); if (des_row_1 < des_top) { @@ -794,7 +794,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -809,7 +809,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( scan_des += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -836,12 +836,12 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert( } FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, FXCODEC_STATUS& err_status) { - FX_DWORD dwSize = (FX_DWORD)m_pFile->GetSize(); + uint32_t dwSize = (uint32_t)m_pFile->GetSize(); if (dwSize <= m_offSet) { return FALSE; } dwSize = dwSize - m_offSet; - FX_DWORD dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, NULL); + uint32_t dwAvail = pBmpModule->GetAvailInput(m_pBmpContext, NULL); if (dwAvail == m_SrcSize) { if (dwSize > FXCODEC_BLOCK_SIZE) { dwSize = FXCODEC_BLOCK_SIZE; @@ -854,7 +854,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, return FALSE; } } else { - FX_DWORD dwConsume = m_SrcSize - dwAvail; + uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { FXSYS_memcpy(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } @@ -872,7 +872,7 @@ FX_BOOL CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, } FX_BOOL CCodec_ProgressiveDecoder::BmpInputImagePositionBufCallback( void* pModule, - FX_DWORD rcd_pos) { + uint32_t rcd_pos) { CCodec_ProgressiveDecoder* pCodec = (CCodec_ProgressiveDecoder*)pModule; pCodec->m_offSet = rcd_pos; FXCODEC_STATUS error_status = FXCODEC_STATUS_ERROR; @@ -917,7 +917,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = m_startX * des_Bpp; + uint32_t des_ScanOffet = m_startX * des_Bpp; int des_top = m_startY; int des_bottom = m_startY + m_sizeY; int des_row_1 = des_row + int(scale_y); @@ -927,7 +927,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, while (++des_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } return; @@ -959,7 +959,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -974,7 +974,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, scan_des += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -998,7 +998,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( FXCODEC_IMAGE_TYPE imageType, CFX_DIBAttribute* pAttribute) { m_offSet = 0; - FX_DWORD size = (FX_DWORD)m_pFile->GetSize(); + uint32_t size = (uint32_t)m_pFile->GetSize(); if (size > FXCODEC_BLOCK_SIZE) { size = FXCODEC_BLOCK_SIZE; } @@ -1028,7 +1028,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( } m_offSet += size; pBmpModule->Input(m_pBmpContext, m_pSrcBuf, size); - FX_DWORD* pPalette = NULL; + uint32_t* pPalette = NULL; int32_t readResult = pBmpModule->ReadHeader( m_pBmpContext, &m_SrcWidth, &m_SrcHeight, &m_BmpIsTopBottom, &m_SrcComponents, &m_SrcPaletteNumber, &pPalette, pAttribute); @@ -1049,7 +1049,7 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( if (m_SrcPaletteNumber) { m_pSrcPalette = FX_Alloc(FX_ARGB, m_SrcPaletteNumber); FXSYS_memcpy(m_pSrcPalette, pPalette, - m_SrcPaletteNumber * sizeof(FX_DWORD)); + m_SrcPaletteNumber * sizeof(uint32_t)); } else { m_pSrcPalette = nullptr; } @@ -1130,8 +1130,8 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( m_offSet += size; bResult = pPngModule->Input(m_pPngContext, m_pSrcBuf, size, pAttribute); while (bResult) { - FX_DWORD remain_size = (FX_DWORD)m_pFile->GetSize() - m_offSet; - FX_DWORD input_size = + uint32_t remain_size = (uint32_t)m_pFile->GetSize() - m_offSet; + uint32_t input_size = remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size; if (input_size == 0) { if (m_pPngContext) { @@ -1231,10 +1231,10 @@ FX_BOOL CCodec_ProgressiveDecoder::DetectImageType( } int32_t frames = 0; pTiffModule->GetFrames(m_pTiffContext, frames); - FX_DWORD bpc; + uint32_t bpc; FX_BOOL ret = pTiffModule->LoadFrameInfo( - m_pTiffContext, 0, (FX_DWORD&)m_SrcWidth, (FX_DWORD&)m_SrcHeight, - (FX_DWORD&)m_SrcComponents, bpc, pAttribute); + m_pTiffContext, 0, (uint32_t&)m_SrcWidth, (uint32_t&)m_SrcHeight, + (uint32_t&)m_SrcComponents, bpc, pAttribute); m_SrcComponents = 4; m_clipBox = FX_RECT(0, 0, m_SrcWidth, m_SrcHeight); if (!ret) { @@ -1475,7 +1475,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, case 1: return; case 2: { - FX_DWORD des_g = 0; + uint32_t des_g = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1499,7 +1499,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16)); } break; case 4: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1513,7 +1513,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, (uint8_t)FXRGB2GRAY((des_r >> 16), (des_g >> 16), (des_b >> 16)); } break; case 5: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1533,7 +1533,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, case 6: return; case 7: { - FX_DWORD des_g = 0; + uint32_t des_g = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1594,7 +1594,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, } } break; case 9: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1610,7 +1610,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, des_scan += des_Bpp - 3; } break; case 10: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1630,7 +1630,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, des_scan += des_Bpp - 3; } break; case 11: { - FX_DWORD des_alpha = 0, des_r = 0, des_g = 0, des_b = 0; + uint32_t des_alpha = 0, des_r = 0, des_g = 0, des_b = 0; for (int j = pPixelWeights->m_SrcStart; j <= pPixelWeights->m_SrcEnd; j++) { int pixel_weight = @@ -1656,7 +1656,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row) { int des_Bpp = pDeviceBitmap->GetBPP() >> 3; - FX_DWORD des_ScanOffet = m_startX * des_Bpp; + uint32_t des_ScanOffet = m_startX * des_Bpp; if (m_bInterpol) { int des_top = m_startY; int des_row_1 = des_row - int(scale_y); @@ -1668,7 +1668,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, while (++des_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -1702,7 +1702,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, } break; case FXDIB_Rgb: case FXDIB_Rgb32: { - FX_DWORD des_b = 0, des_g = 0, des_r = 0; + uint32_t des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -1717,7 +1717,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, scan_des += des_Bpp - 3; } break; case FXDIB_Argb: { - FX_DWORD des_a = 0, des_b = 0, des_g = 0, des_r = 0; + uint32_t des_a = 0, des_b = 0, des_g = 0, des_r = 0; des_b += pWeight->m_Weights[0] * (*scan_src1++); des_g += pWeight->m_Weights[0] * (*scan_src1++); des_r += pWeight->m_Weights[0] * (*scan_src1++); @@ -1743,7 +1743,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, while (++des_row < des_bottom) { uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -1759,7 +1759,7 @@ void CCodec_ProgressiveDecoder::ResampleVert(CFX_DIBitmap* pDeviceBitmap, } uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet; - FX_DWORD size = m_sizeX * des_Bpp; + uint32_t size = m_sizeX * des_Bpp; FXSYS_memcpy(scan_des, scan_src, size); } } @@ -2063,8 +2063,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) { case FXCODEC_IMAGE_PNG: { ICodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule(); while (TRUE) { - FX_DWORD remain_size = (FX_DWORD)m_pFile->GetSize() - m_offSet; - FX_DWORD input_size = + uint32_t remain_size = (uint32_t)m_pFile->GetSize() - m_offSet; + uint32_t input_size = remain_size > FXCODEC_BLOCK_SIZE ? FXCODEC_BLOCK_SIZE : remain_size; if (input_size == 0) { if (m_pPngContext) { diff --git a/core/fxcodec/codec/fx_codec_progress.h b/core/fxcodec/codec/fx_codec_progress.h index e4335ccf47..ccd52a95b1 100644 --- a/core/fxcodec/codec/fx_codec_progress.h +++ b/core/fxcodec/codec/fx_codec_progress.h @@ -122,12 +122,12 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { int pass, int line); static void GifRecordCurrentPositionCallback(void* pModule, - FX_DWORD& cur_pos); + uint32_t& cur_pos); static uint8_t* GifAskLocalPaletteBufCallback(void* pModule, int32_t frame_num, int32_t pal_size); static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, - FX_DWORD rcd_pos, + uint32_t rcd_pos, const FX_RECT& img_rc, int32_t pal_num, void* pal_ptr, @@ -140,7 +140,7 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { int32_t row_num, uint8_t* row_buf); static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, - FX_DWORD rcd_pos); + uint32_t rcd_pos); static void BmpReadScanlineCallback(void* pModule, int32_t row_num, uint8_t* row_buf); @@ -182,9 +182,9 @@ class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { void* m_pBmpContext; void* m_pTiffContext; FXCODEC_IMAGE_TYPE m_imagType; - FX_DWORD m_offSet; + uint32_t m_offSet; uint8_t* m_pSrcBuf; - FX_DWORD m_SrcSize; + uint32_t m_SrcSize; uint8_t* m_pDecodeBuf; int m_ScanlineSize; CFX_DIBitmap* m_pDeviceBitmap; diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/fx_codec_tiff.cpp index 58f08707cb..96249f9d14 100644 --- a/core/fxcodec/codec/fx_codec_tiff.cpp +++ b/core/fxcodec/codec/fx_codec_tiff.cpp @@ -16,7 +16,7 @@ void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData, unsigned int dwProfileSize, int nComponents, int intent, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT); + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT); void IccLib_TranslateImage(void* pTransform, unsigned char* pDest, const unsigned char* pSrc, @@ -30,10 +30,10 @@ class CCodec_TiffContext { FX_BOOL InitDecoder(IFX_FileRead* file_ptr); void GetFrames(int32_t& frames); FX_BOOL LoadFrameInfo(int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute); FX_BOOL Decode(CFX_DIBitmap* pDIBitmap); @@ -42,7 +42,7 @@ class CCodec_TiffContext { IFX_FileStream* out; } io; - FX_DWORD offset; + uint32_t offset; TIFF* tif_ctx; void* icc_ctx; @@ -98,7 +98,7 @@ static tsize_t _tiff_read(thandle_t context, tdata_t buf, tsize_t length) { if (!ret) { return 0; } - pTiffContext->offset += (FX_DWORD)length; + pTiffContext->offset += (uint32_t)length; return length; } static tsize_t _tiff_write(thandle_t context, tdata_t buf, tsize_t length) { @@ -107,17 +107,17 @@ static tsize_t _tiff_write(thandle_t context, tdata_t buf, tsize_t length) { if (!pTiffContext->io.out->WriteBlock(buf, pTiffContext->offset, length)) { return 0; } - pTiffContext->offset += (FX_DWORD)length; + pTiffContext->offset += (uint32_t)length; return length; } static toff_t _tiff_seek(thandle_t context, toff_t offset, int whence) { CCodec_TiffContext* pTiffContext = (CCodec_TiffContext*)context; switch (whence) { case 0: - pTiffContext->offset = (FX_DWORD)offset; + pTiffContext->offset = (uint32_t)offset; break; case 1: - pTiffContext->offset += (FX_DWORD)offset; + pTiffContext->offset += (uint32_t)offset; break; case 2: if (pTiffContext->isDecoder) { @@ -125,20 +125,20 @@ static toff_t _tiff_seek(thandle_t context, toff_t offset, int whence) { return static_cast<toff_t>(-1); } pTiffContext->offset = - (FX_DWORD)(pTiffContext->io.in->GetSize() - offset); + (uint32_t)(pTiffContext->io.in->GetSize() - offset); } else { if (pTiffContext->io.out->GetSize() < (FX_FILESIZE)offset) { return static_cast<toff_t>(-1); } pTiffContext->offset = - (FX_DWORD)(pTiffContext->io.out->GetSize() - offset); + (uint32_t)(pTiffContext->io.out->GetSize() - offset); } break; default: return static_cast<toff_t>(-1); } ASSERT(pTiffContext->isDecoder ? (pTiffContext->offset <= - (FX_DWORD)pTiffContext->io.in->GetSize()) + (uint32_t)pTiffContext->io.in->GetSize()) : TRUE); return pTiffContext->offset; } @@ -234,7 +234,7 @@ void CCodec_TiffContext::GetFrames(int32_t& frames) { (key) = NULL; #define TIFF_EXIF_GETSTRINGINFO(key, tag) \ { \ - FX_DWORD size = 0; \ + uint32_t size = 0; \ uint8_t* buf = NULL; \ TIFFGetField(tif_ctx, tag, &size, &buf); \ if (size && buf) { \ @@ -277,20 +277,20 @@ void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, } // namespace FX_BOOL CCodec_TiffContext::LoadFrameInfo(int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute) { if (!TIFFSetDirectory(tif_ctx, (uint16)frame)) { return FALSE; } uint16_t tif_cs; - FX_DWORD tif_icc_size = 0; + uint32_t tif_icc_size = 0; uint8_t* tif_icc_buf = NULL; uint16_t tif_bpc = 0; uint16_t tif_cps; - FX_DWORD tif_rps; + uint32_t tif_rps; width = height = comps = 0; TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height); @@ -379,10 +379,10 @@ void CCodec_TiffContext::SetPalette(CFX_DIBitmap* pDIBitmap, uint16_t bps) { } int32_t len = 1 << bps; for (int32_t index = 0; index < len; index++) { - FX_DWORD r = red_orig[index] & 0xFF; - FX_DWORD g = green_orig[index] & 0xFF; - FX_DWORD b = blue_orig[index] & 0xFF; - FX_DWORD color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | + uint32_t r = red_orig[index] & 0xFF; + uint32_t g = green_orig[index] & 0xFF; + uint32_t b = blue_orig[index] & 0xFF; + uint32_t color = (uint32_t)b | ((uint32_t)g << 8) | ((uint32_t)r << 16) | (((uint32)0xffL) << 24); pDIBitmap->SetPaletteEntry(index, color); } @@ -404,7 +404,7 @@ FX_BOOL CCodec_TiffContext::Decode1bppRGB(CFX_DIBitmap* pDIBitmap, return FALSE; } uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); - FX_DWORD pitch = pDIBitmap->GetPitch(); + uint32_t pitch = pDIBitmap->GetPitch(); for (int32_t row = 0; row < height; row++) { TIFFReadScanline(tif_ctx, buf, row, 0); for (int32_t j = 0; j < size; j++) { @@ -431,7 +431,7 @@ FX_BOOL CCodec_TiffContext::Decode8bppRGB(CFX_DIBitmap* pDIBitmap, return FALSE; } uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); - FX_DWORD pitch = pDIBitmap->GetPitch(); + uint32_t pitch = pDIBitmap->GetPitch(); for (int32_t row = 0; row < height; row++) { TIFFReadScanline(tif_ctx, buf, row, 0); for (int32_t j = 0; j < size; j++) { @@ -464,7 +464,7 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, return FALSE; } uint8_t* bitMapbuffer = (uint8_t*)pDIBitmap->GetBuffer(); - FX_DWORD pitch = pDIBitmap->GetPitch(); + uint32_t pitch = pDIBitmap->GetPitch(); for (int32_t row = 0; row < height; row++) { TIFFReadScanline(tif_ctx, buf, row, 0); for (int32_t j = 0; j < size - 2; j += 3) { @@ -477,10 +477,10 @@ FX_BOOL CCodec_TiffContext::Decode24bppRGB(CFX_DIBitmap* pDIBitmap, return TRUE; } FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { - FX_DWORD img_wid = pDIBitmap->GetWidth(); - FX_DWORD img_hei = pDIBitmap->GetHeight(); - FX_DWORD width = 0; - FX_DWORD height = 0; + uint32_t img_wid = pDIBitmap->GetWidth(); + uint32_t img_hei = pDIBitmap->GetHeight(); + uint32_t width = 0; + uint32_t height = 0; TIFFGetField(tif_ctx, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(tif_ctx, TIFFTAG_IMAGELENGTH, &height); if (img_wid != width || img_hei != height) { @@ -492,7 +492,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { if (TIFFReadRGBAImageOriented(tif_ctx, img_wid, img_hei, (uint32*)pDIBitmap->GetBuffer(), rotation, 1)) { - for (FX_DWORD row = 0; row < img_hei; row++) { + for (uint32_t row = 0; row < img_hei; row++) { uint8_t* row_buf = (uint8_t*)pDIBitmap->GetScanline(row); _TiffBGRA2RGBA(row_buf, img_wid, 4); } @@ -502,7 +502,7 @@ FX_BOOL CCodec_TiffContext::Decode(CFX_DIBitmap* pDIBitmap) { uint16_t spp, bps; TIFFGetField(tif_ctx, TIFFTAG_SAMPLESPERPIXEL, &spp); TIFFGetField(tif_ctx, TIFFTAG_BITSPERSAMPLE, &bps); - FX_DWORD bpp = bps * spp; + uint32_t bpp = bps * spp; if (bpp == 1) { return Decode1bppRGB(pDIBitmap, height, width, bps, spp); } else if (bpp <= 8) { @@ -526,10 +526,10 @@ void CCodec_TiffModule::GetFrames(void* ctx, int32_t& frames) { } FX_BOOL CCodec_TiffModule::LoadFrameInfo(void* ctx, int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute) { CCodec_TiffContext* pDecoder = (CCodec_TiffContext*)ctx; return pDecoder->LoadFrameInfo(frame, width, height, comps, bpc, pAttribute); diff --git a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp index 720b96ec36..6be90941d6 100644 --- a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp @@ -81,7 +81,7 @@ CJBig2_ArithIaidDecoder::CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA) CJBig2_ArithIaidDecoder::~CJBig2_ArithIaidDecoder() {} void CJBig2_ArithIaidDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, - FX_DWORD* nResult) { + uint32_t* nResult) { int PREV = 1; for (unsigned char i = 0; i < SBSYMCODELEN; ++i) { JBig2ArithCtx* pCX = &m_IAID[PREV]; diff --git a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h index 50327cc151..f1eb68d5df 100644 --- a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h +++ b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h @@ -30,7 +30,7 @@ class CJBig2_ArithIaidDecoder { explicit CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA); ~CJBig2_ArithIaidDecoder(); - void decode(CJBig2_ArithDecoder* pArithDecoder, FX_DWORD* nResult); + void decode(CJBig2_ArithDecoder* pArithDecoder, uint32_t* nResult); private: std::vector<JBig2ArithCtx> m_IAID; diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp index 4ca4be16d4..ddf092dbc4 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.cpp +++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp @@ -26,8 +26,8 @@ CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream) CJBig2_BitStream::~CJBig2_BitStream() {} -int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD* dwResult) { - FX_DWORD dwBitPos = getBitPos(); +int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, uint32_t* dwResult) { + uint32_t dwBitPos = getBitPos(); if (dwBitPos > LengthInBits()) return -1; @@ -45,8 +45,8 @@ int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, FX_DWORD* dwResult) { return 0; } -int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t* nResult) { - FX_DWORD dwBitPos = getBitPos(); +int32_t CJBig2_BitStream::readNBits(uint32_t dwBits, int32_t* nResult) { + uint32_t dwBitPos = getBitPos(); if (dwBitPos > LengthInBits()) return -1; @@ -64,7 +64,7 @@ int32_t CJBig2_BitStream::readNBits(FX_DWORD dwBits, int32_t* nResult) { return 0; } -int32_t CJBig2_BitStream::read1Bit(FX_DWORD* dwResult) { +int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) { if (!IsInBound()) return -1; @@ -91,7 +91,7 @@ int32_t CJBig2_BitStream::read1Byte(uint8_t* cResult) { return 0; } -int32_t CJBig2_BitStream::readInteger(FX_DWORD* dwResult) { +int32_t CJBig2_BitStream::readInteger(uint32_t* dwResult) { if (m_dwByteIdx + 3 >= m_dwLength) return -1; @@ -134,19 +134,19 @@ uint8_t CJBig2_BitStream::getNextByte_arith() const { return m_dwByteIdx + 1 < m_dwLength ? m_pBuf[m_dwByteIdx + 1] : 0xFF; } -FX_DWORD CJBig2_BitStream::getOffset() const { +uint32_t CJBig2_BitStream::getOffset() const { return m_dwByteIdx; } -void CJBig2_BitStream::setOffset(FX_DWORD dwOffset) { +void CJBig2_BitStream::setOffset(uint32_t dwOffset) { m_dwByteIdx = std::min(dwOffset, m_dwLength); } -FX_DWORD CJBig2_BitStream::getBitPos() const { +uint32_t CJBig2_BitStream::getBitPos() const { return (m_dwByteIdx << 3) + m_dwBitIdx; } -void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) { +void CJBig2_BitStream::setBitPos(uint32_t dwBitPos) { m_dwByteIdx = dwBitPos >> 3; m_dwBitIdx = dwBitPos & 7; } @@ -159,11 +159,11 @@ const uint8_t* CJBig2_BitStream::getPointer() const { return m_pBuf + m_dwByteIdx; } -void CJBig2_BitStream::offset(FX_DWORD dwOffset) { +void CJBig2_BitStream::offset(uint32_t dwOffset) { m_dwByteIdx += dwOffset; } -FX_DWORD CJBig2_BitStream::getByteLeft() const { +uint32_t CJBig2_BitStream::getByteLeft() const { return m_dwLength - m_dwByteIdx; } @@ -180,10 +180,10 @@ bool CJBig2_BitStream::IsInBound() const { return m_dwByteIdx < m_dwLength; } -FX_DWORD CJBig2_BitStream::LengthInBits() const { +uint32_t CJBig2_BitStream::LengthInBits() const { return m_dwLength << 3; } -FX_DWORD CJBig2_BitStream::getObjNum() const { +uint32_t CJBig2_BitStream::getObjNum() const { return m_dwObjNum; } diff --git a/core/fxcodec/jbig2/JBig2_BitStream.h b/core/fxcodec/jbig2/JBig2_BitStream.h index 45eb44c46a..191438fee7 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/fxcodec/jbig2/JBig2_BitStream.h @@ -17,39 +17,39 @@ class CJBig2_BitStream { ~CJBig2_BitStream(); // TODO(thestig): readFoo() should return bool. - int32_t readNBits(FX_DWORD nBits, FX_DWORD* dwResult); - int32_t readNBits(FX_DWORD nBits, int32_t* nResult); - int32_t read1Bit(FX_DWORD* dwResult); + int32_t readNBits(uint32_t nBits, uint32_t* dwResult); + int32_t readNBits(uint32_t nBits, int32_t* nResult); + int32_t read1Bit(uint32_t* dwResult); int32_t read1Bit(FX_BOOL* bResult); int32_t read1Byte(uint8_t* cResult); - int32_t readInteger(FX_DWORD* dwResult); + int32_t readInteger(uint32_t* dwResult); int32_t readShortInteger(uint16_t* wResult); void alignByte(); uint8_t getCurByte() const; void incByteIdx(); uint8_t getCurByte_arith() const; uint8_t getNextByte_arith() const; - FX_DWORD getOffset() const; - void setOffset(FX_DWORD dwOffset); - FX_DWORD getBitPos() const; - void setBitPos(FX_DWORD dwBitPos); + uint32_t getOffset() const; + void setOffset(uint32_t dwOffset); + uint32_t getBitPos() const; + void setBitPos(uint32_t dwBitPos); const uint8_t* getBuf() const; - FX_DWORD getLength() const { return m_dwLength; } + uint32_t getLength() const { return m_dwLength; } const uint8_t* getPointer() const; - void offset(FX_DWORD dwOffset); - FX_DWORD getByteLeft() const; - FX_DWORD getObjNum() const; + void offset(uint32_t dwOffset); + uint32_t getByteLeft() const; + uint32_t getObjNum() const; private: void AdvanceBit(); bool IsInBound() const; - FX_DWORD LengthInBits() const; + uint32_t LengthInBits() const; const uint8_t* m_pBuf; - FX_DWORD m_dwLength; - FX_DWORD m_dwByteIdx; - FX_DWORD m_dwBitIdx; - const FX_DWORD m_dwObjNum; + uint32_t m_dwLength; + uint32_t m_dwByteIdx; + uint32_t m_dwBitIdx; + const uint32_t m_dwObjNum; CJBig2_BitStream(const CJBig2_BitStream&) = delete; void operator=(const CJBig2_BitStream&) = delete; diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index da020a6a75..1c316a0dd2 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -230,7 +230,7 @@ int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { return nRet; } -CJBig2_Segment* CJBig2_Context::findSegmentByNumber(FX_DWORD dwNumber) { +CJBig2_Segment* CJBig2_Context::findSegmentByNumber(uint32_t dwNumber) { if (m_pGlobalContext) { CJBig2_Segment* pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber); if (pSeg) { @@ -267,11 +267,11 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { return JBIG2_ERROR_TOO_SHORT; } - FX_DWORD dwTemp; + uint32_t dwTemp; uint8_t cTemp = m_pStream->getCurByte(); if ((cTemp >> 5) == 7) { if (m_pStream->readInteger( - (FX_DWORD*)&pSegment->m_nReferred_to_segment_count) != 0) { + (uint32_t*)&pSegment->m_nReferred_to_segment_count) != 0) { return JBIG2_ERROR_TOO_SHORT; } pSegment->m_nReferred_to_segment_count &= 0x1fffffff; @@ -292,7 +292,7 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { uint8_t cPSize = pSegment->m_cFlags.s.page_association_size ? 4 : 1; if (pSegment->m_nReferred_to_segment_count) { pSegment->m_pReferred_to_segment_numbers = - FX_Alloc(FX_DWORD, pSegment->m_nReferred_to_segment_count); + FX_Alloc(uint32_t, pSegment->m_nReferred_to_segment_count); for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { switch (cSSize) { case 1: @@ -396,7 +396,7 @@ int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment, pPageInfo->m_bIsStriped = TRUE; if (!m_bBufSpecified) { - FX_DWORD height = + uint32_t height = bMaxHeight ? pPageInfo->m_wMaxStripeSize : pPageInfo->m_dwHeight; m_pPage.reset(new CJBig2_Image(pPageInfo->m_dwWidth, height)); } @@ -449,8 +449,8 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, uint8_t cSDHUFFBMSIZE = (wFlags >> 6) & 0x0001; uint8_t cSDHUFFAGGINST = (wFlags >> 7) & 0x0001; if (pSymbolDictDecoder->SDHUFF == 0) { - const FX_DWORD dwTemp = (pSymbolDictDecoder->SDTEMPLATE == 0) ? 8 : 2; - for (FX_DWORD i = 0; i < dwTemp; ++i) { + const uint32_t dwTemp = (pSymbolDictDecoder->SDTEMPLATE == 0) ? 8 : 2; + for (uint32_t i = 0; i < dwTemp; ++i) { if (m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDAT[i]) != 0) return JBIG2_ERROR_TOO_SHORT; } @@ -488,7 +488,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, std::unique_ptr<CJBig2_Image*, FxFreeDeleter> SDINSYMS; if (pSymbolDictDecoder->SDNUMINSYMS != 0) { SDINSYMS.reset(FX_Alloc(CJBig2_Image*, pSymbolDictDecoder->SDNUMINSYMS)); - FX_DWORD dwTemp = 0; + uint32_t dwTemp = 0; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { CJBig2_Segment* pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -665,7 +665,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBH = ri.height; pTRD->SBHUFF = wFlags & 0x0001; pTRD->SBREFINE = (wFlags >> 1) & 0x0001; - FX_DWORD dwTemp = (wFlags >> 2) & 0x0003; + uint32_t dwTemp = (wFlags >> 2) & 0x0003; pTRD->SBSTRIPS = 1 << dwTemp; pTRD->REFCORNER = (JBig2Corner)((wFlags >> 4) & 0x0003); pTRD->TRANSPOSED = (wFlags >> 6) & 0x0001; @@ -751,7 +751,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBSYMCODES = SBSYMCODES.get(); } else { dwTemp = 0; - while ((FX_DWORD)(1 << dwTemp) < pTRD->SBNUMSYMS) { + while ((uint32_t)(1 << dwTemp) < pTRD->SBNUMSYMS) { ++dwTemp; } pTRD->SBSYMCODELEN = (uint8_t)dwTemp; @@ -999,8 +999,8 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, m_pStream->read1Byte(&cFlags) != 0 || m_pStream->readInteger(&pHRD->HGW) != 0 || m_pStream->readInteger(&pHRD->HGH) != 0 || - m_pStream->readInteger((FX_DWORD*)&pHRD->HGX) != 0 || - m_pStream->readInteger((FX_DWORD*)&pHRD->HGY) != 0 || + m_pStream->readInteger((uint32_t*)&pHRD->HGX) != 0 || + m_pStream->readInteger((uint32_t*)&pHRD->HGY) != 0 || m_pStream->readShortInteger(&pHRD->HRX) != 0 || m_pStream->readShortInteger(&pHRD->HRY) != 0) { return JBIG2_ERROR_TOO_SHORT; @@ -1261,10 +1261,10 @@ int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) { } int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo* pRI) { - if (m_pStream->readInteger((FX_DWORD*)&pRI->width) != 0 || - m_pStream->readInteger((FX_DWORD*)&pRI->height) != 0 || - m_pStream->readInteger((FX_DWORD*)&pRI->x) != 0 || - m_pStream->readInteger((FX_DWORD*)&pRI->y) != 0 || + if (m_pStream->readInteger((uint32_t*)&pRI->width) != 0 || + m_pStream->readInteger((uint32_t*)&pRI->height) != 0 || + m_pStream->readInteger((uint32_t*)&pRI->x) != 0 || + m_pStream->readInteger((uint32_t*)&pRI->y) != 0 || m_pStream->read1Byte(&pRI->flags) != 0) { return JBIG2_ERROR_TOO_SHORT; } @@ -1273,7 +1273,7 @@ int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo* pRI) { JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( CJBig2_BitStream* pStream, - FX_DWORD SBNUMSYMS) { + uint32_t SBNUMSYMS) { const size_t kRunCodesSize = 35; int32_t runcodes[kRunCodesSize]; int32_t runcodes_len[kRunCodesSize]; @@ -1291,7 +1291,7 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( int32_t j; int32_t nVal = 0; int32_t nBits = 0; - FX_DWORD nTemp; + uint32_t nTemp; while (true) { if (pStream->read1Bit(&nTemp) != 0) return nullptr; diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index aff3b1bb38..4a32e61489 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -23,7 +23,7 @@ class CPDF_StreamAcc; class IFX_Pause; // Cache is keyed by the ObjNum of a stream and an index within the stream. -using CJBig2_CacheKey = std::pair<FX_DWORD, FX_DWORD>; +using CJBig2_CacheKey = std::pair<uint32_t, uint32_t>; // NB: CJBig2_SymbolDict* is owned. using CJBig2_CachePair = std::pair<CJBig2_CacheKey, CJBig2_SymbolDict*>; @@ -74,7 +74,7 @@ class CJBig2_Context { int32_t decode_RandomOrgnazation(IFX_Pause* pPause); - CJBig2_Segment* findSegmentByNumber(FX_DWORD dwNumber); + CJBig2_Segment* findSegmentByNumber(uint32_t dwNumber); CJBig2_Segment* findReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment, uint8_t cType, @@ -103,7 +103,7 @@ class CJBig2_Context { int32_t parseRegionInfo(JBig2RegionInfo* pRI); JBig2HuffmanCode* decodeSymbolIDHuffmanTable(CJBig2_BitStream* pStream, - FX_DWORD SBNUMSYMS); + uint32_t SBNUMSYMS); void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP); @@ -125,7 +125,7 @@ class CJBig2_Context { std::unique_ptr<CJBig2_GRDProc> m_pGRD; JBig2ArithCtx* m_gbContext; std::unique_ptr<CJBig2_Segment> m_pSegment; - FX_DWORD m_dwOffset; + uint32_t m_dwOffset; JBig2RegionInfo m_ri; std::list<CJBig2_CachePair>* const m_pSymbolDictCache; bool m_bIsGlobal; diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index a3fc33c2be..5f3b47f659 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -66,8 +66,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -81,8 +81,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - FX_DWORD height = GBH & 0x7fffffff; - for (FX_DWORD h = 0; h < height; h++) { + uint32_t height = GBH & 0x7fffffff; + for (uint32_t h = 0; h < height; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); LTP = LTP ^ SLTP; @@ -156,12 +156,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); LTP = LTP ^ SLTP; @@ -175,7 +175,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( line2 |= GBREG->getPixel(1, h - 1) << 1; line2 |= GBREG->getPixel(0, h - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -204,8 +204,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -219,7 +219,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); LTP = LTP ^ SLTP; @@ -293,12 +293,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); LTP = LTP ^ SLTP; @@ -313,7 +313,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( line2 |= GBREG->getPixel(1, h - 1) << 1; line2 |= GBREG->getPixel(0, h - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -338,8 +338,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -353,7 +353,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); LTP = LTP ^ SLTP; @@ -427,12 +427,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); LTP = LTP ^ SLTP; @@ -445,7 +445,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( line2 = GBREG->getPixel(1, h - 1); line2 |= GBREG->getPixel(0, h - 1) << 1; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -471,8 +471,8 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1; + uint32_t CONTEXT; + uint32_t line1; uint8_t *pLine, *pLine1, cVal; int32_t nStride, k; int32_t nLineBytes, nBitsLeft, cc; @@ -485,7 +485,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( nStride = GBREG->m_nStride; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); LTP = LTP ^ SLTP; @@ -546,12 +546,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; LTP = 0; std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); - for (FX_DWORD h = 0; h < GBH; h++) { + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); LTP = LTP ^ SLTP; @@ -562,7 +562,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( line1 = GBREG->getPixel(1, h - 1); line1 |= GBREG->getPixel(0, h - 1) << 1; line2 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -673,7 +673,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage, FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride); pStream->setBitPos(bitpos); - for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) { + for (i = 0; (uint32_t)i < (*pImage)->m_nStride * GBH; i++) { (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i]; } m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; @@ -698,8 +698,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -710,7 +710,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( nStride2 = nStride << 1; nLineBytes = ((GBW + 7) >> 3) - 1; nBitsLeft = GBW - (nLineBytes << 3); - FX_DWORD height = GBH & 0x7fffffff; + uint32_t height = GBH & 0x7fffffff; for (; m_loopIndex < height; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); @@ -793,8 +793,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); @@ -809,7 +809,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( line2 |= pImage->getPixel(1, m_loopIndex - 1) << 1; line2 |= pImage->getPixel(0, m_loopIndex - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { bVal = 0; } else { @@ -848,8 +848,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -942,9 +942,9 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; - for (FX_DWORD h = 0; h < GBH; h++) { + uint32_t CONTEXT; + uint32_t line1, line2, line3; + for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); LTP = LTP ^ SLTP; @@ -959,7 +959,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( line2 |= pImage->getPixel(1, h - 1) << 1; line2 |= pImage->getPixel(0, h - 1) << 2; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, h)) { bVal = 0; } else { @@ -993,8 +993,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; uint8_t *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; @@ -1087,8 +1087,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3; + uint32_t CONTEXT; + uint32_t line1, line2, line3; for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); @@ -1102,7 +1102,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( line2 = pImage->getPixel(1, m_loopIndex - 1); line2 |= pImage->getPixel(0, m_loopIndex - 1) << 1; line3 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { bVal = 0; } else { @@ -1138,8 +1138,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1; + uint32_t CONTEXT; + uint32_t line1; uint8_t *pLine1, cVal; int32_t nStride, k; int32_t nLineBytes, nBitsLeft, cc; @@ -1218,8 +1218,8 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( JBig2ArithCtx* gbContext, IFX_Pause* pPause) { FX_BOOL SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2; + uint32_t CONTEXT; + uint32_t line1, line2; for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); @@ -1231,7 +1231,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( line1 = pImage->getPixel(1, m_loopIndex - 1); line1 |= pImage->getPixel(0, m_loopIndex - 1) << 1; line2 = 0; - for (FX_DWORD w = 0; w < GBW; w++) { + for (uint32_t w = 0; w < GBW; w++) { if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { bVal = 0; } else { diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h index 2a638aa8d6..f6a5448769 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrdProc.h @@ -35,8 +35,8 @@ class CJBig2_GRDProc { FX_RECT GetReplaceRect() const { return m_ReplaceRect; } FX_BOOL MMR; - FX_DWORD GBW; - FX_DWORD GBH; + uint32_t GBW; + uint32_t GBH; uint8_t GBTEMPLATE; FX_BOOL TPGDON; FX_BOOL USESKIP; @@ -109,7 +109,7 @@ class CJBig2_GRDProc { CJBig2_Image* decode_Arith_Template3_unopt(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - FX_DWORD m_loopIndex; + uint32_t m_loopIndex; uint8_t* m_pLine; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProssiveStatus; diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp index c6ff3dd647..17d17d558e 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp @@ -20,13 +20,13 @@ CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder, if (GRTEMPLATE == 0) { if ((GRAT[0] == -1) && (GRAT[1] == -1) && (GRAT[2] == -1) && (GRAT[3] == -1) && (GRREFERENCEDX == 0) && - (GRW == (FX_DWORD)GRREFERENCE->m_nWidth)) { + (GRW == (uint32_t)GRREFERENCE->m_nWidth)) { return decode_Template0_opt(pArithDecoder, grContext); } return decode_Template0_unopt(pArithDecoder, grContext); } - if ((GRREFERENCEDX == 0) && (GRW == (FX_DWORD)GRREFERENCE->m_nWidth)) + if ((GRREFERENCEDX == 0) && (GRW == (uint32_t)GRREFERENCE->m_nWidth)) return decode_Template1_opt(pArithDecoder, grContext); return decode_Template1_unopt(pArithDecoder, grContext); } @@ -35,12 +35,12 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3, line4, line5; + uint32_t CONTEXT; + uint32_t line1, line2, line3, line4, line5; LTP = 0; std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); - for (FX_DWORD h = 0; h < GRH; h++) { + for (uint32_t h = 0; h < GRH; h++) { if (TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0010]); LTP = LTP ^ SLTP; @@ -61,7 +61,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( << 1; line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY + 1) << 2; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { CONTEXT = line5; CONTEXT |= line4 << 3; CONTEXT |= line3 << 6; @@ -104,7 +104,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( << 1; line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX - 1, h - GRREFERENCEDY + 1) << 2; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { bVal = GRREFERENCE->getPixel(w, h); if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w - 1, h - 1)) && (bVal == GRREFERENCE->getPixel(w, h - 1)) && @@ -153,8 +153,8 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( return nullptr; FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line1_r, line2_r, line3_r; + uint32_t CONTEXT; + uint32_t line1, line1_r, line2_r, line3_r; uint8_t *pLine, *pLineR, cVal; intptr_t nStride, nStrideR, nOffset; int32_t k, nBits; @@ -287,12 +287,12 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line2, line3, line4, line5; + uint32_t CONTEXT; + uint32_t line1, line2, line3, line4, line5; LTP = 0; std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); - for (FX_DWORD h = 0; h < GRH; h++) { + for (uint32_t h = 0; h < GRH; h++) { if (TPGRON) { SLTP = pArithDecoder->DECODE(&grContext[0x0008]); LTP = LTP ^ SLTP; @@ -310,7 +310,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( line5 = GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) << 1; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { CONTEXT = line5; CONTEXT |= line4 << 2; CONTEXT |= line3 << 5; @@ -346,7 +346,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( line5 = GRREFERENCE->getPixel(-GRREFERENCEDX + 1, h - GRREFERENCEDY + 1); line5 |= GRREFERENCE->getPixel(-GRREFERENCEDX, h - GRREFERENCEDY + 1) << 1; - for (FX_DWORD w = 0; w < GRW; w++) { + for (uint32_t w = 0; w < GRW; w++) { bVal = GRREFERENCE->getPixel(w, h); if (!(TPGRON && (bVal == GRREFERENCE->getPixel(w - 1, h - 1)) && (bVal == GRREFERENCE->getPixel(w, h - 1)) && @@ -391,8 +391,8 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( return nullptr; FX_BOOL LTP, SLTP, bVal; - FX_DWORD CONTEXT; - FX_DWORD line1, line1_r, line2_r, line3_r; + uint32_t CONTEXT; + uint32_t line1, line1_r, line2_r, line3_r; uint8_t *pLine, *pLineR, cVal; intptr_t nStride, nStrideR, nOffset; int32_t k, nBits; diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.h b/core/fxcodec/jbig2/JBig2_GrrdProc.h index 2c6d02d271..17adf1900e 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.h @@ -30,8 +30,8 @@ class CJBig2_GRRDProc { CJBig2_Image* decode_Template1_opt(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); - FX_DWORD GRW; - FX_DWORD GRH; + uint32_t GRW; + uint32_t GRH; FX_BOOL GRTEMPLATE; CJBig2_Image* GRREFERENCE; int32_t GRREFERENCEDX; diff --git a/core/fxcodec/jbig2/JBig2_GsidProc.cpp b/core/fxcodec/jbig2/JBig2_GsidProc.cpp index 2ac96fc9d8..30f95b8200 100644 --- a/core/fxcodec/jbig2/JBig2_GsidProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GsidProc.cpp @@ -14,7 +14,7 @@ #include "core/fxcodec/jbig2/JBig2_List.h" #include "core/fxcrt/include/fx_basic.h" -FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, +uint32_t* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); @@ -56,11 +56,11 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if (i < GSBPP - 1) pImage->composeFrom(0, 0, GSPLANES.get(i + 1), JBIG2_COMPOSE_XOR); } - std::unique_ptr<FX_DWORD, FxFreeDeleter> GSVALS( - FX_Alloc2D(FX_DWORD, GSW, GSH)); - JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); - for (FX_DWORD y = 0; y < GSH; ++y) { - for (FX_DWORD x = 0; x < GSW; ++x) { + std::unique_ptr<uint32_t, FxFreeDeleter> GSVALS( + FX_Alloc2D(uint32_t, GSW, GSH)); + JBIG2_memset(GSVALS.get(), 0, sizeof(uint32_t) * GSW * GSH); + for (uint32_t y = 0; y < GSH; ++y) { + for (uint32_t x = 0; x < GSW; ++x) { for (int32_t i = 0; i < GSBPP; ++i) { GSVALS.get()[y * GSW + x] |= GSPLANES.get(i)->getPixel(x, y) << i; } @@ -69,7 +69,7 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, return GSVALS.release(); } -FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, +uint32_t* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = GSMMR; @@ -106,10 +106,10 @@ FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, JBIG2_COMPOSE_XOR); J = J - 1; } - std::unique_ptr<FX_DWORD> GSVALS(FX_Alloc2D(FX_DWORD, GSW, GSH)); - JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); - for (FX_DWORD y = 0; y < GSH; ++y) { - for (FX_DWORD x = 0; x < GSW; ++x) { + std::unique_ptr<uint32_t> GSVALS(FX_Alloc2D(uint32_t, GSW, GSH)); + JBIG2_memset(GSVALS.get(), 0, sizeof(uint32_t) * GSW * GSH); + for (uint32_t y = 0; y < GSH; ++y) { + for (uint32_t x = 0; x < GSW; ++x) { for (J = 0; J < GSBPP; ++J) { GSVALS.get()[y * GSW + x] |= GSPLANES.get()[J]->getPixel(x, y) << J; } diff --git a/core/fxcodec/jbig2/JBig2_GsidProc.h b/core/fxcodec/jbig2/JBig2_GsidProc.h index 8124db54d2..b3bd022f03 100644 --- a/core/fxcodec/jbig2/JBig2_GsidProc.h +++ b/core/fxcodec/jbig2/JBig2_GsidProc.h @@ -17,18 +17,18 @@ struct JBig2ArithCtx; class CJBig2_GSIDProc { public: - FX_DWORD* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, + uint32_t* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause); - FX_DWORD* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); + uint32_t* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); public: FX_BOOL GSMMR; FX_BOOL GSUSESKIP; uint8_t GSBPP; - FX_DWORD GSW; - FX_DWORD GSH; + uint32_t GSW; + uint32_t GSH; uint8_t GSTEMPLATE; CJBig2_Image* GSKIP; }; diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp index a9f15343d2..aaa617cd73 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp @@ -14,10 +14,10 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { - FX_DWORD ng, mg; + uint32_t ng, mg; int32_t x, y; - FX_DWORD HBPP; - FX_DWORD* GI; + uint32_t HBPP; + uint32_t* GI; std::unique_ptr<CJBig2_Image> HSKIP; std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); @@ -37,7 +37,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, } } HBPP = 1; - while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { + while ((uint32_t)(1 << HBPP) < HNUMPATS) { HBPP++; } std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); @@ -56,7 +56,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, for (ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; y = (HGY + mg * HRX - ng * HRY) >> 8; - FX_DWORD pat_index = GI[mg * HGW + ng]; + uint32_t pat_index = GI[mg * HGW + ng]; if (pat_index >= HNUMPATS) { pat_index = HNUMPATS - 1; } @@ -69,13 +69,13 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { - FX_DWORD ng, mg; + uint32_t ng, mg; int32_t x, y; - FX_DWORD* GI; + uint32_t* GI; std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); - FX_DWORD HBPP = 1; - while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { + uint32_t HBPP = 1; + while ((uint32_t)(1 << HBPP) < HNUMPATS) { HBPP++; } std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); @@ -92,7 +92,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, for (ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; y = (HGY + mg * HRX - ng * HRY) >> 8; - FX_DWORD pat_index = GI[mg * HGW + ng]; + uint32_t pat_index = GI[mg * HGW + ng]; if (pat_index >= HNUMPATS) { pat_index = HNUMPATS - 1; } diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.h b/core/fxcodec/jbig2/JBig2_HtrdProc.h index 62ae57d9c9..b4f55c6124 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.h +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.h @@ -24,17 +24,17 @@ class CJBig2_HTRDProc { CJBig2_Image* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); public: - FX_DWORD HBW; - FX_DWORD HBH; + uint32_t HBW; + uint32_t HBH; FX_BOOL HMMR; uint8_t HTEMPLATE; - FX_DWORD HNUMPATS; + uint32_t HNUMPATS; CJBig2_Image** HPATS; FX_BOOL HDEFPIXEL; JBig2ComposeOp HCOMBOP; FX_BOOL HENABLESKIP; - FX_DWORD HGW; - FX_DWORD HGH; + uint32_t HGW; + uint32_t HGH; int32_t HGX; int32_t HGY; uint16_t HRX; diff --git a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp index afcc17a55e..050b5e6074 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp @@ -18,13 +18,13 @@ int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, int nVal = 0; int nBits = 0; while (1) { - FX_DWORD nTmp; + uint32_t nTmp; if (m_pStream->read1Bit(&nTmp) == -1) break; nVal = (nVal << 1) | nTmp; ++nBits; - for (FX_DWORD i = 0; i < pTable->Size(); ++i) { + for (uint32_t i = 0; i < pTable->Size(); ++i) { if (pTable->GetPREFLEN()[i] == nBits && pTable->GetCODES()[i] == nVal) { if (pTable->IsHTOOB() && i == pTable->Size() - 1) return JBIG2_OOB; @@ -32,7 +32,7 @@ int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, if (m_pStream->readNBits(pTable->GetRANGELEN()[i], &nTmp) == -1) return -1; - FX_DWORD offset = pTable->IsHTOOB() ? 3 : 2; + uint32_t offset = pTable->IsHTOOB() ? 3 : 2; if (i == pTable->Size() - offset) *nResult = pTable->GetRANGELOW()[i] - nTmp; else diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp index 7b1855113d..038921e740 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp +++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp @@ -15,7 +15,7 @@ #include "core/fxcrt/include/fx_memory.h" CJBig2_HuffmanTable::CJBig2_HuffmanTable(const JBig2TableLine* pTable, - FX_DWORD nLines, + uint32_t nLines, bool bHTOOB) : m_bOK(true), HTOOB(bHTOOB), NTEMP(nLines) { ParseFromStandardTable(pTable); @@ -32,7 +32,7 @@ void CJBig2_HuffmanTable::ParseFromStandardTable(const JBig2TableLine* pTable) { PREFLEN.resize(NTEMP); RANGELEN.resize(NTEMP); RANGELOW.resize(NTEMP); - for (FX_DWORD i = 0; i < NTEMP; ++i) { + for (uint32_t i = 0; i < NTEMP; ++i) { PREFLEN[i] = pTable[i].PREFLEN; RANGELEN[i] = pTable[i].RANDELEN; RANGELOW[i] = pTable[i].RANGELOW; @@ -48,8 +48,8 @@ bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) { HTOOB = !!(cTemp & 0x01); unsigned char HTPS = ((cTemp >> 1) & 0x07) + 1; unsigned char HTRS = ((cTemp >> 4) & 0x07) + 1; - FX_DWORD HTLOW; - FX_DWORD HTHIGH; + uint32_t HTLOW; + uint32_t HTHIGH; if (pStream->readInteger(&HTLOW) == -1 || pStream->readInteger(&HTHIGH) == -1) { return false; @@ -99,7 +99,7 @@ bool CJBig2_HuffmanTable::ParseFromCodedBuffer(CJBig2_BitStream* pStream) { void CJBig2_HuffmanTable::InitCodes() { int lenmax = 0; - for (FX_DWORD i = 0; i < NTEMP; ++i) + for (uint32_t i = 0; i < NTEMP; ++i) lenmax = std::max(PREFLEN[i], lenmax); CODES.resize(NTEMP); @@ -113,7 +113,7 @@ void CJBig2_HuffmanTable::InitCodes() { for (int i = 1; i <= lenmax; ++i) { FIRSTCODE[i] = (FIRSTCODE[i - 1] + LENCOUNT[i - 1]) << 1; int CURCODE = FIRSTCODE[i]; - for (FX_DWORD j = 0; j < NTEMP; ++j) { + for (uint32_t j = 0; j < NTEMP; ++j) { if (PREFLEN[j] == i) CODES[j] = CURCODE++; } diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.h b/core/fxcodec/jbig2/JBig2_HuffmanTable.h index 7a31cf60dd..9b29847e4d 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanTable.h +++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.h @@ -17,7 +17,7 @@ struct JBig2TableLine; class CJBig2_HuffmanTable { public: CJBig2_HuffmanTable(const JBig2TableLine* pTable, - FX_DWORD nLines, + uint32_t nLines, bool bHTOOB); explicit CJBig2_HuffmanTable(CJBig2_BitStream* pStream); @@ -25,7 +25,7 @@ class CJBig2_HuffmanTable { ~CJBig2_HuffmanTable(); bool IsHTOOB() const { return HTOOB; } - FX_DWORD Size() const { return NTEMP; } + uint32_t Size() const { return NTEMP; } const std::vector<int>& GetCODES() const { return CODES; } const std::vector<int>& GetPREFLEN() const { return PREFLEN; } const std::vector<int>& GetRANGELEN() const { return RANGELEN; } @@ -40,7 +40,7 @@ class CJBig2_HuffmanTable { bool m_bOK; bool HTOOB; - FX_DWORD NTEMP; + uint32_t NTEMP; std::vector<int> CODES; std::vector<int> PREFLEN; std::vector<int> RANGELEN; diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp index bb3674000f..7297199112 100644 --- a/core/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/fxcodec/jbig2/JBig2_Image.cpp @@ -149,14 +149,14 @@ FX_BOOL CJBig2_Image::composeFrom(int32_t x, return pSrc->composeTo(this, x, y, op, pSrcRect); } #define JBIG2_GETDWORD(buf) \ - ((FX_DWORD)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) + ((uint32_t)(((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3])) CJBig2_Image* CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) { int32_t m, n, j; uint8_t *pLineSrc, *pLineDst; - FX_DWORD wTmp; + uint32_t wTmp; uint8_t *pSrc, *pSrcEnd, *pDst, *pDstEnd; if (w == 0 || h == 0) { return NULL; @@ -180,7 +180,7 @@ CJBig2_Image* CJBig2_Image::subImage(int32_t x, pDst = pLineDst; pDstEnd = pLineDst + pImage->m_nStride; for (; pDst < pDstEnd; pSrc += 4, pDst += 4) { - *((FX_DWORD*)pDst) = *((FX_DWORD*)pSrc); + *((uint32_t*)pDst) = *((uint32_t*)pSrc); } pLineSrc += m_nStride; pLineDst += pImage->m_nStride; @@ -213,9 +213,9 @@ void CJBig2_Image::expand(int32_t h, FX_BOOL v) { if (!m_pData || h <= m_nHeight) { return; } - FX_DWORD dwH = pdfium::base::checked_cast<FX_DWORD>(h); - FX_DWORD dwStride = pdfium::base::checked_cast<FX_DWORD>(m_nStride); - FX_DWORD dwHeight = pdfium::base::checked_cast<FX_DWORD>(m_nHeight); + uint32_t dwH = pdfium::base::checked_cast<uint32_t>(h); + uint32_t dwStride = pdfium::base::checked_cast<uint32_t>(m_nStride); + uint32_t dwHeight = pdfium::base::checked_cast<uint32_t>(m_nHeight); FX_SAFE_DWORD safeMemSize = dwH; safeMemSize *= dwStride; if (!safeMemSize.IsValid()) { @@ -240,7 +240,7 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, int32_t xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0; - FX_DWORD s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0, + uint32_t s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0, tmp = 0, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0; uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; @@ -700,11 +700,11 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, if ((xd0 & ~31) == ((xd1 - 1) & ~31)) { if ((xs0 & ~31) == ((xs1 - 1) & ~31)) { if (s1 > d1) { - FX_DWORD shift = s1 - d1; + uint32_t shift = s1 - d1; for (int32_t yy = yd0; yy < yd1; yy++) { - FX_DWORD tmp1 = JBIG2_GETDWORD(lineSrc) << shift; - FX_DWORD tmp2 = JBIG2_GETDWORD(lineDst); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(lineSrc) << shift; + uint32_t tmp2 = JBIG2_GETDWORD(lineDst); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskM) | ((tmp1 | tmp2) & maskM); @@ -730,11 +730,11 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, lineDst += pDst->m_nStride; } } else { - FX_DWORD shift = d1 - s1; + uint32_t shift = d1 - s1; for (int32_t yy = yd0; yy < yd1; yy++) { - FX_DWORD tmp1 = JBIG2_GETDWORD(lineSrc) >> shift; - FX_DWORD tmp2 = JBIG2_GETDWORD(lineDst); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(lineSrc) >> shift; + uint32_t tmp2 = JBIG2_GETDWORD(lineDst); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskM) | ((tmp1 | tmp2) & maskM); @@ -761,13 +761,13 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, } } } else { - FX_DWORD shift1 = s1 - d1; - FX_DWORD shift2 = 32 - shift1; + uint32_t shift1 = s1 - d1; + uint32_t shift2 = 32 - shift1; for (int32_t yy = yd0; yy < yd1; yy++) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(lineSrc) << shift1) | + uint32_t tmp1 = (JBIG2_GETDWORD(lineSrc) << shift1) | (JBIG2_GETDWORD(lineSrc + 4) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(lineDst); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(lineDst); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskM) | ((tmp1 | tmp2) & maskM); @@ -795,17 +795,17 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, } } else { if (s1 > d1) { - FX_DWORD shift1 = s1 - d1; - FX_DWORD shift2 = 32 - shift1; + uint32_t shift1 = s1 - d1; + uint32_t shift2 = 32 - shift1; int32_t middleDwords = (xd1 >> 5) - ((xd0 + 31) >> 5); for (int32_t yy = yd0; yy < yd1; yy++) { uint8_t* sp = lineSrc; uint8_t* dp = lineDst; if (d1 != 0) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(sp) << shift1) | + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift1) | (JBIG2_GETDWORD(sp + 4) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskL) | ((tmp1 | tmp2) & maskL); @@ -831,10 +831,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } for (int32_t xx = 0; xx < middleDwords; xx++) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(sp) << shift1) | + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift1) | (JBIG2_GETDWORD(sp + 4) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = tmp1 | tmp2; @@ -860,12 +860,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } if (d2 != 0) { - FX_DWORD tmp1 = + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift1) | (((sp + 4) < lineSrc + lineLeft ? JBIG2_GETDWORD(sp + 4) : 0) >> shift2); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskR) | ((tmp1 | tmp2) & maskR); @@ -897,9 +897,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, uint8_t* sp = lineSrc; uint8_t* dp = lineDst; if (d1 != 0) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp); + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskL) | ((tmp1 | tmp2) & maskL); @@ -925,9 +925,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } for (int32_t xx = 0; xx < middleDwords; xx++) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp); + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = tmp1 | tmp2; @@ -953,9 +953,9 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } if (d2 != 0) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp); + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskR) | ((tmp1 | tmp2) & maskR); @@ -982,16 +982,16 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, lineDst += pDst->m_nStride; } } else { - FX_DWORD shift1 = d1 - s1; - FX_DWORD shift2 = 32 - shift1; + uint32_t shift1 = d1 - s1; + uint32_t shift2 = 32 - shift1; int32_t middleDwords = (xd1 >> 5) - ((xd0 + 31) >> 5); for (int32_t yy = yd0; yy < yd1; yy++) { uint8_t* sp = lineSrc; uint8_t* dp = lineDst; if (d1 != 0) { - FX_DWORD tmp1 = JBIG2_GETDWORD(sp) >> shift1; - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp1 = JBIG2_GETDWORD(sp) >> shift1; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskL) | ((tmp1 | tmp2) & maskL); @@ -1016,10 +1016,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } for (int32_t xx = 0; xx < middleDwords; xx++) { - FX_DWORD tmp1 = (JBIG2_GETDWORD(sp) << shift2) | + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift2) | ((JBIG2_GETDWORD(sp + 4)) >> shift1); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = tmp1 | tmp2; @@ -1045,12 +1045,12 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, dp += 4; } if (d2 != 0) { - FX_DWORD tmp1 = + uint32_t tmp1 = (JBIG2_GETDWORD(sp) << shift2) | (((sp + 4) < lineSrc + lineLeft ? JBIG2_GETDWORD(sp + 4) : 0) >> shift1); - FX_DWORD tmp2 = JBIG2_GETDWORD(dp); - FX_DWORD tmp = 0; + uint32_t tmp2 = JBIG2_GETDWORD(dp); + uint32_t tmp = 0; switch (op) { case JBIG2_COMPOSE_OR: tmp = (tmp2 & ~maskR) | ((tmp1 | tmp2) & maskR); diff --git a/core/fxcodec/jbig2/JBig2_Page.h b/core/fxcodec/jbig2/JBig2_Page.h index 6a33549145..e9ffa76791 100644 --- a/core/fxcodec/jbig2/JBig2_Page.h +++ b/core/fxcodec/jbig2/JBig2_Page.h @@ -10,10 +10,10 @@ #include "core/fxcrt/include/fx_system.h" struct JBig2PageInfo { - FX_DWORD m_dwWidth; - FX_DWORD m_dwHeight; - FX_DWORD m_dwResolutionX; - FX_DWORD m_dwResolutionY; + uint32_t m_dwWidth; + uint32_t m_dwHeight; + uint32_t m_dwResolutionX; + uint32_t m_dwResolutionY; uint8_t m_cFlags; FX_BOOL m_bIsStriped; uint16_t m_wMaxStripeSize; diff --git a/core/fxcodec/jbig2/JBig2_PatternDict.cpp b/core/fxcodec/jbig2/JBig2_PatternDict.cpp index 3db672e86b..e74d83647c 100644 --- a/core/fxcodec/jbig2/JBig2_PatternDict.cpp +++ b/core/fxcodec/jbig2/JBig2_PatternDict.cpp @@ -15,7 +15,7 @@ CJBig2_PatternDict::CJBig2_PatternDict() { CJBig2_PatternDict::~CJBig2_PatternDict() { if (HDPATS) { - for (FX_DWORD i = 0; i < NUMPATS; i++) { + for (uint32_t i = 0; i < NUMPATS; i++) { delete HDPATS[i]; } FX_Free(HDPATS); diff --git a/core/fxcodec/jbig2/JBig2_PatternDict.h b/core/fxcodec/jbig2/JBig2_PatternDict.h index 3196fcaaf3..dddd4747f0 100644 --- a/core/fxcodec/jbig2/JBig2_PatternDict.h +++ b/core/fxcodec/jbig2/JBig2_PatternDict.h @@ -16,7 +16,7 @@ class CJBig2_PatternDict { ~CJBig2_PatternDict(); - FX_DWORD NUMPATS; + uint32_t NUMPATS; CJBig2_Image** HDPATS; }; diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp index 5b67aadb57..12f66c3b7d 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp @@ -16,7 +16,7 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { - FX_DWORD GRAY; + uint32_t GRAY; CJBig2_Image* BHDC = nullptr; std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; @@ -59,7 +59,7 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { - FX_DWORD GRAY; + uint32_t GRAY; CJBig2_Image* BHDC = nullptr; std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; diff --git a/core/fxcodec/jbig2/JBig2_PddProc.h b/core/fxcodec/jbig2/JBig2_PddProc.h index ce0089ac14..6bdd186ffc 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.h +++ b/core/fxcodec/jbig2/JBig2_PddProc.h @@ -27,7 +27,7 @@ class CJBig2_PDDProc { FX_BOOL HDMMR; uint8_t HDPW; uint8_t HDPH; - FX_DWORD GRAYMAX; + uint32_t GRAYMAX; uint8_t HDTEMPLATE; }; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index 54c0bb9dd6..81d7c89270 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -24,18 +24,18 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( std::vector<JBig2ArithCtx>* gbContext, std::vector<JBig2ArithCtx>* grContext) { CJBig2_Image** SDNEWSYMS; - FX_DWORD HCHEIGHT, NSYMSDECODED; + uint32_t HCHEIGHT, NSYMSDECODED; int32_t HCDH; - FX_DWORD SYMWIDTH, TOTWIDTH; + uint32_t SYMWIDTH, TOTWIDTH; int32_t DW; CJBig2_Image* BS; - FX_DWORD I, J, REFAGGNINST; + uint32_t I, J, REFAGGNINST; FX_BOOL* EXFLAGS; - FX_DWORD EXINDEX; + uint32_t EXINDEX; FX_BOOL CUREXFLAG; - FX_DWORD EXRUNLENGTH; - FX_DWORD nTmp; - FX_DWORD SBNUMSYMS; + uint32_t EXRUNLENGTH; + uint32_t nTmp; + uint32_t SBNUMSYMS; uint8_t SBSYMCODELEN; int32_t RDXI, RDYI; CJBig2_Image** SBSYMS; @@ -55,7 +55,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( std::unique_ptr<CJBig2_ArithIntDecoder> IARDW(new CJBig2_ArithIntDecoder); std::unique_ptr<CJBig2_ArithIntDecoder> IARDH(new CJBig2_ArithIntDecoder); nTmp = 0; - while ((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { + while ((uint32_t)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp++; } IAID.reset(new CJBig2_ArithIaidDecoder((uint8_t)nTmp)); @@ -124,7 +124,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( pDecoder->SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; SBNUMSYMS = pDecoder->SBNUMSYMS; nTmp = 0; - while ((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { + while ((uint32_t)(1 << nTmp) < SBNUMSYMS) { nTmp++; } SBSYMCODELEN = (uint8_t)nTmp; @@ -192,7 +192,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( FX_Free(SBSYMS); } else if (REFAGGNINST == 1) { SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; - FX_DWORD IDI; + uint32_t IDI; IAID->decode(pArithDecoder, &IDI); IARDX->decode(pArithDecoder, &RDXI); IARDY->decode(pArithDecoder, &RDYI); @@ -283,26 +283,26 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( std::vector<JBig2ArithCtx>* grContext, IFX_Pause* pPause) { CJBig2_Image** SDNEWSYMS; - FX_DWORD* SDNEWSYMWIDTHS; - FX_DWORD HCHEIGHT, NSYMSDECODED; + uint32_t* SDNEWSYMWIDTHS; + uint32_t HCHEIGHT, NSYMSDECODED; int32_t HCDH; - FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM; + uint32_t SYMWIDTH, TOTWIDTH, HCFIRSTSYM; int32_t DW; CJBig2_Image *BS, *BHC; - FX_DWORD I, J, REFAGGNINST; + uint32_t I, J, REFAGGNINST; FX_BOOL* EXFLAGS; - FX_DWORD EXINDEX; + uint32_t EXINDEX; FX_BOOL CUREXFLAG; - FX_DWORD EXRUNLENGTH; + uint32_t EXRUNLENGTH; int32_t nVal, nBits; - FX_DWORD nTmp; - FX_DWORD SBNUMSYMS; + uint32_t nTmp; + uint32_t SBNUMSYMS; uint8_t SBSYMCODELEN; JBig2HuffmanCode* SBSYMCODES; - FX_DWORD IDI; + uint32_t IDI; int32_t RDXI, RDYI; - FX_DWORD BMSIZE; - FX_DWORD stride; + uint32_t BMSIZE; + uint32_t stride; CJBig2_Image** SBSYMS; std::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder( new CJBig2_HuffmanDecoder(pStream)); @@ -311,8 +311,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( SDNEWSYMWIDTHS = nullptr; BHC = nullptr; if (SDREFAGG == 0) { - SDNEWSYMWIDTHS = FX_Alloc(FX_DWORD, SDNUMNEWSYMS); - FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(FX_DWORD)); + SDNEWSYMWIDTHS = FX_Alloc(uint32_t, SDNUMNEWSYMS); + FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(uint32_t)); } std::unique_ptr<CJBig2_SymbolDict> pDict(new CJBig2_SymbolDict()); std::unique_ptr<CJBig2_HuffmanTable> pTable; @@ -370,7 +370,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( SBNUMSYMS = pDecoder->SBNUMSYMS; SBSYMCODES = FX_Alloc(JBig2HuffmanCode, SBNUMSYMS); nTmp = 1; - while ((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { + while ((uint32_t)(1 << nTmp) < SBNUMSYMS) { nTmp++; } for (I = 0; I < SBNUMSYMS; I++) { @@ -433,7 +433,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } else if (REFAGGNINST == 1) { SBNUMSYMS = SDNUMINSYMS + SDNUMNEWSYMS; nTmp = 1; - while ((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { + while ((uint32_t)(1 << nTmp) < SBNUMSYMS) { nTmp++; } SBSYMCODELEN = (uint8_t)nTmp; @@ -499,7 +499,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } pStream->alignByte(); pStream->offset(2); - if ((FX_DWORD)nVal != (pStream->getOffset() - nTmp)) { + if ((uint32_t)nVal != (pStream->getOffset() - nTmp)) { delete BS; FX_Free(SBSYMS); goto failed; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h index edfc37263b..4febc8d553 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.h +++ b/core/fxcodec/jbig2/JBig2_SddProc.h @@ -32,10 +32,10 @@ class CJBig2_SDDProc { public: FX_BOOL SDHUFF; FX_BOOL SDREFAGG; - FX_DWORD SDNUMINSYMS; + uint32_t SDNUMINSYMS; CJBig2_Image** SDINSYMS; - FX_DWORD SDNUMNEWSYMS; - FX_DWORD SDNUMEXSYMS; + uint32_t SDNUMNEWSYMS; + uint32_t SDNUMEXSYMS; CJBig2_HuffmanTable* SDHUFFDH; CJBig2_HuffmanTable* SDHUFFDW; CJBig2_HuffmanTable* SDHUFFBMSIZE; diff --git a/core/fxcodec/jbig2/JBig2_Segment.h b/core/fxcodec/jbig2/JBig2_Segment.h index 61550ada09..d89d652699 100644 --- a/core/fxcodec/jbig2/JBig2_Segment.h +++ b/core/fxcodec/jbig2/JBig2_Segment.h @@ -35,7 +35,7 @@ class CJBig2_Segment { ~CJBig2_Segment(); - FX_DWORD m_dwNumber; + uint32_t m_dwNumber; union { struct { uint8_t type : 6; @@ -45,13 +45,13 @@ class CJBig2_Segment { uint8_t c; } m_cFlags; int32_t m_nReferred_to_segment_count; - FX_DWORD* m_pReferred_to_segment_numbers; - FX_DWORD m_dwPage_association; - FX_DWORD m_dwData_length; + uint32_t* m_pReferred_to_segment_numbers; + uint32_t m_dwPage_association; + uint32_t m_dwData_length; - FX_DWORD m_dwHeader_Length; - FX_DWORD m_dwObjNum; - FX_DWORD m_dwDataOffset; + uint32_t m_dwHeader_Length; + uint32_t m_dwObjNum; + uint32_t m_dwDataOffset; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp index 1a078a1592..5b0ef19505 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp @@ -25,7 +25,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, STRIPT *= SBSTRIPS; STRIPT = -STRIPT; - FX_DWORD NINSTANCES = 0; + uint32_t NINSTANCES = 0; while (NINSTANCES < SBNUMINSTANCES) { int32_t DT; if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &DT) != 0) @@ -58,8 +58,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, } uint8_t CURT = 0; if (SBSTRIPS != 1) { - FX_DWORD nTmp = 1; - while ((FX_DWORD)(1 << nTmp) < SBSTRIPS) { + uint32_t nTmp = 1; + while ((uint32_t)(1 << nTmp) < SBSTRIPS) { nTmp++; } int32_t nVal; @@ -71,9 +71,9 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, int32_t TI = STRIPT + CURT; int32_t nVal = 0; int32_t nBits = 0; - FX_DWORD IDI; + uint32_t IDI; for (;;) { - FX_DWORD nTmp; + uint32_t nTmp; if (pStream->read1Bit(&nTmp) != 0) return nullptr; @@ -109,13 +109,13 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, return nullptr; } pStream->alignByte(); - FX_DWORD nTmp = pStream->getOffset(); + uint32_t nTmp = pStream->getOffset(); CJBig2_Image* IBOI = SBSYMS[IDI]; if (!IBOI) return nullptr; - FX_DWORD WOI = IBOI->m_nWidth; - FX_DWORD HOI = IBOI->m_nHeight; + uint32_t WOI = IBOI->m_nWidth; + uint32_t HOI = IBOI->m_nHeight; if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) return nullptr; @@ -142,7 +142,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, pStream->alignByte(); pStream->offset(2); - if ((FX_DWORD)nVal != (pStream->getOffset() - nTmp)) { + if ((uint32_t)nVal != (pStream->getOffset() - nTmp)) { delete IBI; return nullptr; } @@ -150,8 +150,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, if (!IBI) { continue; } - FX_DWORD WI = IBI->m_nWidth; - FX_DWORD HI = IBI->m_nHeight; + uint32_t WI = IBI->m_nWidth; + uint32_t HI = IBI->m_nHeight; if (TRANSPOSED == 0 && ((REFCORNER == JBIG2_CORNER_TOPRIGHT) || (REFCORNER == JBIG2_CORNER_BOTTOMRIGHT))) { CURS = CURS + WI - 1; @@ -270,7 +270,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, STRIPT *= SBSTRIPS; STRIPT = -STRIPT; int32_t FIRSTS = 0; - FX_DWORD NINSTANCES = 0; + uint32_t NINSTANCES = 0; while (NINSTANCES < SBNUMINSTANCES) { int32_t CURS = 0; int32_t DT; @@ -299,7 +299,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, pIAIT->decode(pArithDecoder, &CURT); int32_t TI = STRIPT + CURT; - FX_DWORD IDI; + uint32_t IDI; pIAID->decode(pArithDecoder, &IDI); if (IDI >= SBNUMSYMS) return nullptr; @@ -324,8 +324,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, pIARDX->decode(pArithDecoder, &RDXI); pIARDY->decode(pArithDecoder, &RDYI); CJBig2_Image* IBOI = SBSYMS[IDI]; - FX_DWORD WOI = IBOI->m_nWidth; - FX_DWORD HOI = IBOI->m_nHeight; + uint32_t WOI = IBOI->m_nWidth; + uint32_t HOI = IBOI->m_nHeight; if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { return nullptr; } @@ -347,8 +347,8 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if (!pIBI) return nullptr; - FX_DWORD WI = pIBI->m_nWidth; - FX_DWORD HI = pIBI->m_nHeight; + uint32_t WI = pIBI->m_nWidth; + uint32_t HI = pIBI->m_nHeight; if (TRANSPOSED == 0 && ((REFCORNER == JBIG2_CORNER_TOPRIGHT) || (REFCORNER == JBIG2_CORNER_BOTTOMRIGHT))) { CURS += WI - 1; diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h index d73e012296..fdad75fb6e 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.h +++ b/core/fxcodec/jbig2/JBig2_TrdProc.h @@ -50,11 +50,11 @@ class CJBig2_TRDProc { public: FX_BOOL SBHUFF; FX_BOOL SBREFINE; - FX_DWORD SBW; - FX_DWORD SBH; - FX_DWORD SBNUMINSTANCES; - FX_DWORD SBSTRIPS; - FX_DWORD SBNUMSYMS; + uint32_t SBW; + uint32_t SBH; + uint32_t SBNUMINSTANCES; + uint32_t SBSTRIPS; + uint32_t SBNUMSYMS; JBig2HuffmanCode* SBSYMCODES; uint8_t SBSYMCODELEN; diff --git a/core/fxcodec/lbmp/fx_bmp.cpp b/core/fxcodec/lbmp/fx_bmp.cpp index 90d8fe1247..be5d93e1b8 100644 --- a/core/fxcodec/lbmp/fx_bmp.cpp +++ b/core/fxcodec/lbmp/fx_bmp.cpp @@ -14,11 +14,11 @@ const size_t kBmpCoreHeaderSize = 12; const size_t kBmpInfoHeaderSize = 40; // TODO(thestig): Replace with FXDWORD_GET_LSBFIRST? -FX_DWORD GetDWord_LSBFirst(uint8_t* p) { +uint32_t GetDWord_LSBFirst(uint8_t* p) { return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); } -void SetDWord_LSBFirst(uint8_t* p, FX_DWORD v) { +void SetDWord_LSBFirst(uint8_t* p, uint32_t v) { p[0] = (uint8_t)v; p[1] = (uint8_t)(v >> 8); p[2] = (uint8_t)(v >> 16); @@ -65,7 +65,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { if (bmp_ptr == NULL) { return 0; } - FX_DWORD skip_size_org = bmp_ptr->skip_size; + uint32_t skip_size_org = bmp_ptr->skip_size; if (bmp_ptr->decode_status == BMP_D_STATUS_HEADER) { ASSERT(sizeof(BmpFileHeader) == 14); BmpFileHeader* bmp_header_ptr = NULL; @@ -81,7 +81,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { bmp_error(bmp_ptr, "Not A Bmp Image"); return 0; } - if (bmp_ptr->avail_in < sizeof(FX_DWORD)) { + if (bmp_ptr->avail_in < sizeof(uint32_t)) { bmp_ptr->skip_size = skip_size_org; return 2; } @@ -182,7 +182,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { case 8: case 16: case 24: { - if (bmp_ptr->color_used > ((FX_DWORD)1) << bmp_ptr->bitCounts) { + if (bmp_ptr->color_used > ((uint32_t)1) << bmp_ptr->bitCounts) { bmp_error(bmp_ptr, "The Bmp File Is Corrupt"); return 0; } @@ -227,8 +227,8 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { bmp_error(bmp_ptr, "The Bmp File Is Corrupt"); return 0; } - FX_DWORD* mask; - if (bmp_read_data(bmp_ptr, (uint8_t**)&mask, 3 * sizeof(FX_DWORD)) == + uint32_t* mask; + if (bmp_read_data(bmp_ptr, (uint8_t**)&mask, 3 * sizeof(uint32_t)) == NULL) { bmp_ptr->skip_size = skip_size_org; return 2; @@ -259,14 +259,14 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { bmp_ptr->pal_num = bmp_ptr->color_used; } uint8_t* src_pal_ptr = NULL; - FX_DWORD src_pal_size = bmp_ptr->pal_num * (bmp_ptr->pal_type ? 3 : 4); + uint32_t src_pal_size = bmp_ptr->pal_num * (bmp_ptr->pal_type ? 3 : 4); if (bmp_read_data(bmp_ptr, (uint8_t**)&src_pal_ptr, src_pal_size) == NULL) { bmp_ptr->skip_size = skip_size_org; return 2; } FX_Free(bmp_ptr->pal_ptr); - bmp_ptr->pal_ptr = FX_Alloc(FX_DWORD, bmp_ptr->pal_num); + bmp_ptr->pal_ptr = FX_Alloc(uint32_t, bmp_ptr->pal_num); int32_t src_pal_index = 0; if (bmp_ptr->pal_type == BMP_PAL_OLD) { while (src_pal_index < bmp_ptr->pal_num) { @@ -388,7 +388,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) { uint8_t* second_byte_ptr = NULL; bmp_ptr->col_num = 0; while (TRUE) { - FX_DWORD skip_size_org = bmp_ptr->skip_size; + uint32_t skip_size_org = bmp_ptr->skip_size; if (bmp_read_data(bmp_ptr, &first_byte_ptr, 1) == NULL) { return 2; } @@ -490,7 +490,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { uint8_t* second_byte_ptr = NULL; bmp_ptr->col_num = 0; while (TRUE) { - FX_DWORD skip_size_org = bmp_ptr->skip_size; + uint32_t skip_size_org = bmp_ptr->skip_size; if (bmp_read_data(bmp_ptr, &first_byte_ptr, 1) == NULL) { return 2; } @@ -608,7 +608,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { } uint8_t* bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size) { + uint32_t data_size) { if (bmp_ptr == NULL || bmp_ptr->avail_in < bmp_ptr->skip_size + data_size) { return NULL; } @@ -624,12 +624,12 @@ void bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status) { } void bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { bmp_ptr->next_in = src_buf; bmp_ptr->avail_in = src_size; bmp_ptr->skip_size = 0; } -FX_DWORD bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, +uint32_t bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr) { if (avial_buf_ptr) { *avial_buf_ptr = NULL; @@ -656,7 +656,7 @@ void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr) { } } static void WriteFileHeader(BmpFileHeaderPtr head_ptr, uint8_t* dst_buf) { - FX_DWORD offset; + uint32_t offset; offset = 0; SetWord_LSBFirst(&dst_buf[offset], head_ptr->bfType); offset += 2; @@ -670,7 +670,7 @@ static void WriteFileHeader(BmpFileHeaderPtr head_ptr, uint8_t* dst_buf) { offset += 4; } static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, uint8_t* dst_buf) { - FX_DWORD offset; + uint32_t offset; offset = sizeof(BmpFileHeader); SetDWord_LSBFirst(&dst_buf[offset], info_head_ptr->biSize); offset += 4; @@ -697,12 +697,12 @@ static void WriteInfoHeader(BmpInfoHeaderPtr info_head_ptr, uint8_t* dst_buf) { } static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { + uint32_t& dst_size) { if (bmp_ptr->info_header.biBitCount != 16 && bmp_ptr->info_header.biBitCount != 32) { return; } - FX_DWORD size, dst_pos, i; + uint32_t size, dst_pos, i; size = bmp_ptr->src_pitch * bmp_ptr->src_row * bmp_ptr->info_header.biBitCount / 16; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -712,9 +712,9 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, return; } FXSYS_memset(&dst_buf[dst_pos], 0, size); - FX_DWORD mask_red; - FX_DWORD mask_green; - FX_DWORD mask_blue; + uint32_t mask_red; + uint32_t mask_green; + uint32_t mask_blue; mask_red = 0x7C00; mask_green = 0x03E0; mask_blue = 0x001F; @@ -765,7 +765,7 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, if (bmp_ptr->src_bpp == 32) { i++; } - FX_DWORD pix_val = 0; + uint32_t pix_val = 0; pix_val |= (b >> blue_bits) & mask_blue; pix_val |= (g << green_bits) & mask_green; pix_val |= (r << red_bits) & mask_red; @@ -783,13 +783,13 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, static void bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { + uint32_t& dst_size) { if (bmp_ptr->info_header.biBitCount == 16) { bmp_encode_bitfields(bmp_ptr, dst_buf, dst_size); return; } - FX_DWORD size, dst_pos; - FX_DWORD dst_pitch = + uint32_t size, dst_pos; + uint32_t dst_pitch = (bmp_ptr->src_width * bmp_ptr->info_header.biBitCount + 31) / 32 * 4; size = dst_pitch * bmp_ptr->src_row; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -820,8 +820,8 @@ static uint8_t bmp_rle8_search(const uint8_t* buf, int32_t len) { } static void bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { - FX_DWORD size, dst_pos, index; + uint32_t& dst_size) { + uint32_t size, dst_pos, index; uint8_t rle[2] = {0}; size = bmp_ptr->src_pitch * bmp_ptr->src_row * 2; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -868,8 +868,8 @@ static uint8_t bmp_rle4_search(const uint8_t* buf, int32_t len) { } static void bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { - FX_DWORD size, dst_pos, index; + uint32_t& dst_size) { + uint32_t size, dst_pos, index; uint8_t rle[2] = {0}; size = bmp_ptr->src_pitch * bmp_ptr->src_row; dst_pos = bmp_ptr->file_header.bfOffBits; @@ -907,14 +907,14 @@ static void bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, } FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size) { - FX_DWORD head_size = sizeof(BmpFileHeader) + sizeof(BmpInfoHeader); - FX_DWORD pal_size = sizeof(FX_DWORD) * bmp_ptr->pal_num; + uint32_t& dst_size) { + uint32_t head_size = sizeof(BmpFileHeader) + sizeof(BmpInfoHeader); + uint32_t pal_size = sizeof(uint32_t) * bmp_ptr->pal_num; if (bmp_ptr->info_header.biClrUsed > 0 && bmp_ptr->info_header.biClrUsed < bmp_ptr->pal_num) { - pal_size = sizeof(FX_DWORD) * bmp_ptr->info_header.biClrUsed; + pal_size = sizeof(uint32_t) * bmp_ptr->info_header.biClrUsed; } - dst_size = head_size + sizeof(FX_DWORD) * bmp_ptr->pal_num; + dst_size = head_size + sizeof(uint32_t) * bmp_ptr->pal_num; dst_buf = FX_TryAlloc(uint8_t, dst_size); if (dst_buf == NULL) { return FALSE; diff --git a/core/fxcodec/lbmp/fx_bmp.h b/core/fxcodec/lbmp/fx_bmp.h index c0baf8693a..870eae478c 100644 --- a/core/fxcodec/lbmp/fx_bmp.h +++ b/core/fxcodec/lbmp/fx_bmp.h @@ -13,7 +13,7 @@ #define BMP_WIDTHBYTES(width, bitCount) ((width * bitCount) + 31) / 32 * 4 #define BMP_PAL_ENCODE(a, r, g, b) \ - (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) + (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define BMP_D_STATUS_HEADER 0x01 #define BMP_D_STATUS_PAL 0x02 #define BMP_D_STATUS_DATA_PRE 0x03 @@ -36,30 +36,30 @@ #pragma pack(1) typedef struct tagBmpFileHeader { uint16_t bfType; - FX_DWORD bfSize; + uint32_t bfSize; uint16_t bfReserved1; uint16_t bfReserved2; - FX_DWORD bfOffBits; + uint32_t bfOffBits; } BmpFileHeader, *BmpFileHeaderPtr; typedef struct tagBmpCoreHeader { - FX_DWORD bcSize; + uint32_t bcSize; uint16_t bcWidth; uint16_t bcHeight; uint16_t bcPlanes; uint16_t bcBitCount; } BmpCoreHeader, *BmpCoreHeaderPtr; typedef struct tagBmpInfoHeader { - FX_DWORD biSize; + uint32_t biSize; int32_t biWidth; int32_t biHeight; uint16_t biPlanes; uint16_t biBitCount; - FX_DWORD biCompression; - FX_DWORD biSizeImage; + uint32_t biCompression; + uint32_t biSizeImage; int32_t biXPelsPerMeter; int32_t biYPelsPerMeter; - FX_DWORD biClrUsed; - FX_DWORD biClrImportant; + uint32_t biClrUsed; + uint32_t biClrImportant; } BmpInfoHeader, *BmpInfoHeaderPtr; #pragma pack() @@ -77,36 +77,36 @@ struct tag_bmp_decompress_struct { BmpInfoHeaderPtr bmp_infoheader_ptr; int32_t width; int32_t height; - FX_DWORD compress_flag; + uint32_t compress_flag; int32_t components; int32_t src_row_bytes; int32_t out_row_bytes; uint8_t* out_row_buffer; uint16_t bitCounts; - FX_DWORD color_used; + uint32_t color_used; FX_BOOL imgTB_flag; int32_t pal_num; int32_t pal_type; - FX_DWORD* pal_ptr; - FX_DWORD data_size; - FX_DWORD img_data_offset; - FX_DWORD img_ifh_size; + uint32_t* pal_ptr; + uint32_t data_size; + uint32_t img_data_offset; + uint32_t img_ifh_size; int32_t row_num; int32_t col_num; int32_t dpi_x; int32_t dpi_y; - FX_DWORD mask_red; - FX_DWORD mask_green; - FX_DWORD mask_blue; + uint32_t mask_red; + uint32_t mask_green; + uint32_t mask_blue; FX_BOOL (*bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, - FX_DWORD cur_pos); + uint32_t cur_pos); void (*bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, int32_t row_num, uint8_t* row_buf); uint8_t* next_in; - FX_DWORD avail_in; - FX_DWORD skip_size; + uint32_t avail_in; + uint32_t skip_size; int32_t decode_status; }; void bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg); @@ -119,12 +119,12 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr); int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr); uint8_t* bmp_read_data(bmp_decompress_struct_p bmp_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size); + uint32_t data_size); void bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status); void bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, uint8_t* src_buf, - FX_DWORD src_size); -FX_DWORD bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, + uint32_t src_size); +uint32_t bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, uint8_t** avial_buf_ptr); typedef struct tag_bmp_compress_struct bmp_compress_struct; typedef bmp_compress_struct* bmp_compress_struct_p; @@ -133,12 +133,12 @@ struct tag_bmp_compress_struct { BmpFileHeader file_header; BmpInfoHeader info_header; uint8_t* src_buf; - FX_DWORD src_pitch; - FX_DWORD src_row; + uint32_t src_pitch; + uint32_t src_row; uint8_t src_bpp; - FX_DWORD src_width; + uint32_t src_width; FX_BOOL src_free; - FX_DWORD* pal_ptr; + uint32_t* pal_ptr; uint16_t pal_num; uint8_t bit_type; }; @@ -147,7 +147,7 @@ bmp_compress_struct_p bmp_create_compress(); void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr); FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_size); + uint32_t& dst_size); uint16_t GetWord_LSBFirst(uint8_t* p); void SetWord_LSBFirst(uint8_t* p, uint16_t v); diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp index b20b4dfdec..059fa9a70b 100644 --- a/core/fxcodec/lgif/fx_gif.cpp +++ b/core/fxcodec/lgif/fx_gif.cpp @@ -8,11 +8,11 @@ #include "core/fxcodec/lbmp/fx_bmp.h" -void CGifLZWDecoder::Input(uint8_t* src_buf, FX_DWORD src_size) { +void CGifLZWDecoder::Input(uint8_t* src_buf, uint32_t src_size) { next_in = src_buf; avail_in = src_size; } -FX_DWORD CGifLZWDecoder::GetAvailInput() { +uint32_t CGifLZWDecoder::GetAvailInput() { return avail_in; } void CGifLZWDecoder::InitTable(uint8_t code_len) { @@ -62,11 +62,11 @@ void CGifLZWDecoder::AddCode(uint16_t prefix_code, uint8_t append_char) { } } } -int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) { +int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) { if (des_size == 0) { return 3; } - FX_DWORD i = 0; + uint32_t i = 0; if (stack_size != 0) { if (des_size < stack_size) { FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size); @@ -145,10 +145,10 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) { return 0; } static FX_BOOL gif_grow_buf(uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD size) { + uint32_t& dst_len, + uint32_t size) { if (dst_len < size) { - FX_DWORD len_org = dst_len; + uint32_t len_org = dst_len; while (dst_buf && dst_len < size) { dst_len <<= 1; dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len); @@ -166,18 +166,18 @@ static FX_BOOL gif_grow_buf(uint8_t*& dst_buf, return TRUE; } static inline void gif_cut_index(uint8_t& val, - FX_DWORD index, + uint32_t index, uint8_t index_bit, uint8_t index_bit_use, uint8_t bit_use) { - FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use; + uint32_t cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use; val |= ((index & cut) >> index_bit_use) << bit_use; } static inline uint8_t gif_cut_buf(const uint8_t* buf, - FX_DWORD& offset, + uint32_t& offset, uint8_t bit_cut, uint8_t& bit_offset, - FX_DWORD& bit_num) { + uint32_t& bit_num) { if (bit_cut != 8) { uint16_t index = 0; index |= ((1 << bit_cut) - 1) << (7 - bit_offset); @@ -212,7 +212,7 @@ void CGifLZWEncoder::ClearTable() { void CGifLZWEncoder::Start(uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, - FX_DWORD& offset) { + uint32_t& offset) { code_size = code_len + 1; src_bit_cut = code_size; if (code_len == 0) { @@ -233,8 +233,8 @@ void CGifLZWEncoder::Start(uint8_t code_len, src_bit_offset, src_bit_num); } void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { if (!gif_grow_buf(dst_buf, dst_len, offset + GIF_DATA_BLOCK + 1)) { longjmp(jmp, 1); } @@ -244,10 +244,10 @@ void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, FXSYS_memset(index_buf, 0, GIF_DATA_BLOCK); index_buf_len = 0; } -void CGifLZWEncoder::EncodeString(FX_DWORD index, +void CGifLZWEncoder::EncodeString(uint32_t index, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { uint8_t index_bit_use; index_bit_use = 0; if (index_buf_len == GIF_DATA_BLOCK) { @@ -302,10 +302,10 @@ void CGifLZWEncoder::EncodeString(FX_DWORD index, } } FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf, - FX_DWORD src_len, + uint32_t src_len, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { uint8_t suffix; if (setjmp(jmp)) { return FALSE; @@ -333,7 +333,7 @@ FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf, return TRUE; } FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf, - FX_DWORD& offset, + uint32_t& offset, uint8_t& bit_offset) { for (uint16_t i = table_cur; i < index_num; i++) { if (code_table[i].prefix == code_table[index_num].prefix && @@ -349,8 +349,8 @@ FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf, return FALSE; } void CGifLZWEncoder::Finish(uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset) { + uint32_t& dst_len, + uint32_t& offset) { EncodeString(code_table[index_num].prefix, dst_buf, dst_len, offset); EncodeString(code_end, dst_buf, dst_len, offset); bit_offset = 0; @@ -491,7 +491,7 @@ int32_t gif_read_header(gif_decompress_struct_p gif_ptr) { if (gif_ptr == NULL) { return 0; } - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; ASSERT(sizeof(GifHeader) == 6); GifHeader* gif_header_ptr = NULL; if (gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6) == NULL) { @@ -600,7 +600,7 @@ int32_t gif_get_frame(gif_decompress_struct_p gif_ptr) { case GIF_D_STATUS_IMG_DATA: { uint8_t* data_size_ptr = NULL; uint8_t* data_ptr = NULL; - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) { return 2; } @@ -640,7 +640,7 @@ void gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) { uint8_t* data_size_ptr = NULL; uint8_t* data_ptr = NULL; - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; switch (gif_ptr->decode_status) { case GIF_D_STATUS_EXT_CE: { if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) { @@ -751,7 +751,7 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) { gif_error(gif_ptr, "No Image Header Info"); return 0; } - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; ASSERT(sizeof(GifImageInfo) == 9); GifImageInfo* gif_img_info_ptr = NULL; if (gif_read_data(gif_ptr, (uint8_t**)&gif_img_info_ptr, 9) == NULL) { @@ -826,9 +826,9 @@ int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) { } uint8_t* data_size_ptr = NULL; uint8_t* data_ptr = NULL; - FX_DWORD skip_size_org = gif_ptr->skip_size; + uint32_t skip_size_org = gif_ptr->skip_size; GifImage* gif_image_ptr = gif_ptr->img_ptr_arr_ptr->GetAt(frame_num); - FX_DWORD gif_img_row_bytes = gif_image_ptr->image_info_ptr->width; + uint32_t gif_img_row_bytes = gif_image_ptr->image_info_ptr->width; if (gif_ptr->decode_status == GIF_D_STATUS_TAIL) { if (gif_image_ptr->image_row_buf) { FX_Free(gif_image_ptr->image_row_buf); @@ -991,7 +991,7 @@ void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status) { } uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size) { + uint32_t data_size) { if (gif_ptr == NULL || gif_ptr->avail_in < gif_ptr->skip_size + data_size) { return NULL; } @@ -1001,12 +1001,12 @@ uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr, } void gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, - FX_DWORD src_size) { + uint32_t src_size) { gif_ptr->next_in = src_buf; gif_ptr->avail_in = src_size; gif_ptr->skip_size = 0; } -FX_DWORD gif_get_avail_input(gif_decompress_struct_p gif_ptr, +uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr) { if (avial_buf_ptr) { *avial_buf_ptr = NULL; @@ -1021,7 +1021,7 @@ int32_t gif_get_frame_num(gif_decompress_struct_p gif_ptr) { } static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len) { + uint32_t& dst_len) { if (gif_ptr->cur_offset) { return TRUE; } @@ -1050,10 +1050,10 @@ static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr, } return TRUE; } -void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height) { +void interlace_buf(const uint8_t* buf, uint32_t pitch, uint32_t height) { CFX_ArrayTemplate<uint8_t*> pass[4]; int i, j; - FX_DWORD row; + uint32_t row; row = 0; uint8_t* temp; while (row < height) { @@ -1082,11 +1082,11 @@ void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height) { } } static void gif_write_block_data(const uint8_t* src_buf, - FX_DWORD src_len, + uint32_t src_len, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& dst_offset) { - FX_DWORD src_offset = 0; + uint32_t& dst_len, + uint32_t& dst_offset) { + uint32_t src_offset = 0; while (src_len > GIF_DATA_BLOCK) { dst_buf[dst_offset++] = GIF_DATA_BLOCK; FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], GIF_DATA_BLOCK); @@ -1100,7 +1100,7 @@ static void gif_write_block_data(const uint8_t* src_buf, } static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len) { + uint32_t& dst_len) { if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) { return FALSE; } @@ -1134,7 +1134,7 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, GifLF& lf = (GifLF&)gif_ptr->image_info_ptr->local_flag; dst_buf[gif_ptr->cur_offset++] = gif_ptr->image_info_ptr->local_flag; if (gif_ptr->local_pal) { - FX_DWORD pal_size = sizeof(GifPalette) * gif_ptr->lpal_num; + uint32_t pal_size = sizeof(GifPalette) * gif_ptr->lpal_num; if (!gif_grow_buf(dst_buf, dst_len, pal_size + gif_ptr->cur_offset)) { return FALSE; } @@ -1152,7 +1152,7 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, } gif_ptr->img_encoder_ptr->Start(code_bit, gif_ptr->src_buf, dst_buf, gif_ptr->cur_offset); - FX_DWORD i; + uint32_t i; for (i = 0; i < gif_ptr->src_row; i++) { if (!gif_ptr->img_encoder_ptr->Encode( &gif_ptr->src_buf[i * gif_ptr->src_pitch], @@ -1207,11 +1207,11 @@ static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr, } FX_BOOL gif_encode(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len) { + uint32_t& dst_len) { if (!gif_write_header(gif_ptr, dst_buf, dst_len)) { return FALSE; } - FX_DWORD cur_offset = gif_ptr->cur_offset; + uint32_t cur_offset = gif_ptr->cur_offset; FX_BOOL res = TRUE; if (gif_ptr->frames) { gif_ptr->cur_offset--; diff --git a/core/fxcodec/lgif/fx_gif.h b/core/fxcodec/lgif/fx_gif.h index 5ed9ce1fe2..47e5eebab7 100644 --- a/core/fxcodec/lgif/fx_gif.h +++ b/core/fxcodec/lgif/fx_gif.h @@ -103,7 +103,7 @@ typedef struct tagGifImage { GifPalette* local_pal_ptr; GifImageInfo* image_info_ptr; uint8_t image_code_size; - FX_DWORD image_data_pos; + uint32_t image_data_pos; uint8_t* image_row_buf; int32_t image_row_num; } GifImage; @@ -121,10 +121,10 @@ class CGifLZWDecoder { CGifLZWDecoder(FX_CHAR* error_ptr = NULL) { err_msg_ptr = error_ptr; } void InitTable(uint8_t code_len); - int32_t Decode(uint8_t* des_buf, FX_DWORD& des_size); + int32_t Decode(uint8_t* des_buf, uint32_t& des_size); - void Input(uint8_t* src_buf, FX_DWORD src_size); - FX_DWORD GetAvailInput(); + void Input(uint8_t* src_buf, uint32_t src_size); + uint32_t GetAvailInput(); private: void ClearTable(); @@ -142,10 +142,10 @@ class CGifLZWDecoder { uint16_t code_old; uint8_t* next_in; - FX_DWORD avail_in; + uint32_t avail_in; uint8_t bits_left; - FX_DWORD code_store; + uint32_t code_store; FX_CHAR* err_msg_ptr; }; @@ -160,29 +160,29 @@ class CGifLZWEncoder { void Start(uint8_t code_len, const uint8_t* src_buf, uint8_t*& dst_buf, - FX_DWORD& offset); + uint32_t& offset); FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_len, + uint32_t src_len, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset); - void Finish(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset); + uint32_t& dst_len, + uint32_t& offset); + void Finish(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); private: void ClearTable(); FX_BOOL LookUpInTable(const uint8_t* buf, - FX_DWORD& offset, + uint32_t& offset, uint8_t& bit_offset); - void EncodeString(FX_DWORD index, + void EncodeString(uint32_t index, uint8_t*& dst_buf, - FX_DWORD& dst_len, - FX_DWORD& offset); - void WriteBlock(uint8_t*& dst_buf, FX_DWORD& dst_len, FX_DWORD& offset); + uint32_t& dst_len, + uint32_t& offset); + void WriteBlock(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); jmp_buf jmp; - FX_DWORD src_offset; + uint32_t src_offset; uint8_t src_bit_offset; uint8_t src_bit_cut; - FX_DWORD src_bit_num; + uint32_t src_bit_num; uint8_t code_size; uint16_t code_clear; uint16_t code_end; @@ -213,23 +213,23 @@ struct tag_gif_decompress_struct { uint8_t bc_index; uint8_t pixel_aspect; CGifLZWDecoder* img_decoder_ptr; - FX_DWORD img_row_offset; - FX_DWORD img_row_avail_size; + uint32_t img_row_offset; + uint32_t img_row_avail_size; uint8_t img_pass_num; CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr; uint8_t* (*gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, int32_t pal_size); uint8_t* next_in; - FX_DWORD avail_in; + uint32_t avail_in; int32_t decode_status; - FX_DWORD skip_size; + uint32_t skip_size; void (*gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, - FX_DWORD* cur_pos_ptr); + uint32_t* cur_pos_ptr); void (*gif_get_row_fn)(gif_decompress_struct_p gif_ptr, int32_t row_num, uint8_t* row_buf); FX_BOOL (*gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, - FX_DWORD cur_pos, + uint32_t cur_pos, int32_t left, int32_t top, int32_t width, int32_t height, int32_t pal_num, void* pal_ptr, int32_t delay_time, FX_BOOL user_input, @@ -243,11 +243,11 @@ typedef gif_compress_struct* gif_compress_struct_p; typedef gif_compress_struct_p* gif_compress_struct_pp; struct tag_gif_compress_struct { const uint8_t* src_buf; - FX_DWORD src_pitch; - FX_DWORD src_width; - FX_DWORD src_row; - FX_DWORD cur_offset; - FX_DWORD frames; + uint32_t src_pitch; + uint32_t src_width; + uint32_t src_row; + uint32_t cur_offset; + uint32_t frames; GifHeader* header_ptr; GifLSD* lsd_ptr; GifPalette* global_pal; @@ -258,11 +258,11 @@ struct tag_gif_compress_struct { CGifLZWEncoder* img_encoder_ptr; uint8_t* cmt_data_ptr; - FX_DWORD cmt_data_len; + uint32_t cmt_data_len; GifGCE* gce_ptr; GifPTE* pte_ptr; const uint8_t* pte_data_ptr; - FX_DWORD pte_data_len; + uint32_t pte_data_len; }; void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); @@ -281,16 +281,16 @@ void gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num); uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr, uint8_t** des_buf_pp, - FX_DWORD data_size); + uint32_t data_size); void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status); void gif_input_buffer(gif_decompress_struct_p gif_ptr, uint8_t* src_buf, - FX_DWORD src_size); -FX_DWORD gif_get_avail_input(gif_decompress_struct_p gif_ptr, + uint32_t src_size); +uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr, uint8_t** avial_buf_ptr); -void interlace_buf(const uint8_t* buf, FX_DWORD width, FX_DWORD height); +void interlace_buf(const uint8_t* buf, uint32_t width, uint32_t height); FX_BOOL gif_encode(gif_compress_struct_p gif_ptr, uint8_t*& dst_buf, - FX_DWORD& dst_len); + uint32_t& dst_len); #endif // CORE_FXCODEC_LGIF_FX_GIF_H_ diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h index 1789de33aa..a9f3c23d29 100644 --- a/core/fxcrt/extension.h +++ b/core/fxcrt/extension.h @@ -15,8 +15,8 @@ class IFXCRT_FileAccess { public: virtual ~IFXCRT_FileAccess() {} - virtual FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) = 0; - virtual FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) = 0; + virtual FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0; + virtual FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) = 0; virtual void Close() = 0; virtual void Release() = 0; virtual FX_FILESIZE GetSize() const = 0; @@ -51,7 +51,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { void GetPath(CFX_WideString& wsPath) override { wsPath = m_path; } - IFX_FileStream* CreateFileStream(FX_DWORD dwModes) override { + IFX_FileStream* CreateFileStream(uint32_t dwModes) override { return FX_CreateFileStream(m_path, dwModes); } @@ -63,7 +63,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { protected: CFX_WideString m_path; - FX_DWORD m_RefCount; + uint32_t m_RefCount; }; #endif // PDF_ENABLE_XFA @@ -87,7 +87,7 @@ class CFX_CRTFileStream final : public IFX_FileStream { protected: IFXCRT_FileAccess* m_pFile; - FX_DWORD m_dwCount; + uint32_t m_dwCount; }; #define FX_MEMSTREAM_BlockSize (64 * 1024) @@ -129,7 +129,7 @@ class CFX_MemoryStream final : public IFX_MemoryStream { return this; } void Release() override { - FX_DWORD nCount = --m_dwCount; + uint32_t nCount = --m_dwCount; if (nCount) { return; } @@ -282,12 +282,12 @@ class CFX_MemoryStream final : public IFX_MemoryStream { protected: CFX_ArrayTemplate<uint8_t*> m_Blocks; - FX_DWORD m_dwCount; + uint32_t m_dwCount; size_t m_nTotalSize; size_t m_nCurSize; size_t m_nCurPos; size_t m_nGrowSize; - FX_DWORD m_dwFlags; + uint32_t m_dwFlags; FX_BOOL ExpandBlocks(size_t size) { if (m_nCurSize < size) { m_nCurSize = size; @@ -320,12 +320,12 @@ struct FX_MTRANDOMCONTEXT { mti = MT_N + 1; bHaveSeed = FALSE; } - FX_DWORD mti; + uint32_t mti; FX_BOOL bHaveSeed; - FX_DWORD mt[MT_N]; + uint32_t mt[MT_N]; }; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); +FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); #endif #ifdef __cplusplus } diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index 10113c9d5e..95fa8f52a0 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -149,7 +149,7 @@ IFX_ArabicChar* IFX_ArabicChar::Create() { return new CFX_ArabicChar; } FX_BOOL CFX_ArabicChar::IsArabicChar(FX_WCHAR wch) const { - FX_DWORD dwRet = + uint32_t dwRet = kTextLayoutCodeProperties[(uint16_t)wch] & FX_CHARTYPEBITSMASK; return dwRet >= FX_CHARTYPE_ArabicAlef; } diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 191694e415..ab9299694e 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -11,14 +11,14 @@ #include "core/fxcrt/include/fx_basic.h" #include "third_party/base/numerics/safe_math.h" -static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { +static int _Buffer_itoa(char* buf, int i, uint32_t flags) { if (i == 0) { buf[0] = '0'; return 1; } char buf1[32]; int buf_pos = 31; - FX_DWORD u = i; + uint32_t u = i; if ((flags & FXFORMAT_SIGNED) && i < 0) { u = -i; } @@ -43,7 +43,7 @@ static int _Buffer_itoa(char* buf, int i, FX_DWORD flags) { } return len; } -CFX_ByteString CFX_ByteString::FormatInteger(int i, FX_DWORD flags) { +CFX_ByteString CFX_ByteString::FormatInteger(int i, uint32_t flags) { char buf[32]; return CFX_ByteStringC(buf, _Buffer_itoa(buf, i, flags)); } @@ -1012,17 +1012,17 @@ void CFX_ByteString::TrimLeft(FX_CHAR chTarget) { void CFX_ByteString::TrimLeft() { TrimLeft("\x09\x0a\x0b\x0c\x0d\x20"); } -FX_DWORD CFX_ByteString::GetID(FX_STRSIZE start_pos) const { +uint32_t CFX_ByteString::GetID(FX_STRSIZE start_pos) const { return CFX_ByteStringC(*this).GetID(start_pos); } -FX_DWORD CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const { +uint32_t CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const { if (m_Length == 0) { return 0; } if (start_pos < 0 || start_pos >= m_Length) { return 0; } - FX_DWORD strid = 0; + uint32_t strid = 0; if (start_pos + 4 > m_Length) { for (FX_STRSIZE i = 0; i < m_Length - start_pos; i++) { strid = strid * 256 + m_Ptr[start_pos + i]; diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index aa899b6c17..28c8ac0f32 100644 --- a/core/fxcrt/fx_basic_buffer.cpp +++ b/core/fxcrt/fx_basic_buffer.cpp @@ -116,7 +116,7 @@ CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(int i) { return *this; } -CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(FX_DWORD i) { +CFX_ByteTextBuf& CFX_ByteTextBuf::operator<<(uint32_t i) { char buf[32]; FXSYS_itoa(i, buf, 10); AppendBlock(buf, FXSYS_strlen(buf)); @@ -208,11 +208,11 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(int i) { } return *this; } -CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(FX_DWORD i) { +CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint32_t i) { if (m_pStream) { - m_pStream->WriteBlock(&i, sizeof(FX_DWORD)); + m_pStream->WriteBlock(&i, sizeof(uint32_t)); } else { - m_SavingBuf.AppendBlock(&i, sizeof(FX_DWORD)); + m_SavingBuf.AppendBlock(&i, sizeof(uint32_t)); } return *this; } @@ -257,7 +257,7 @@ void CFX_ArchiveSaver::Write(const void* pData, FX_STRSIZE dwSize) { m_SavingBuf.AppendBlock(pData, dwSize); } } -CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize) { +CFX_ArchiveLoader::CFX_ArchiveLoader(const uint8_t* pData, uint32_t dwSize) { m_pLoadingBuf = pData; m_LoadingPos = 0; m_LoadingSize = dwSize; @@ -276,8 +276,8 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(int& i) { Read(&i, sizeof(int)); return *this; } -CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(FX_DWORD& i) { - Read(&i, sizeof(FX_DWORD)); +CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(uint32_t& i) { + Read(&i, sizeof(uint32_t)); return *this; } CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(FX_FLOAT& i) { @@ -308,7 +308,7 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator>>(CFX_WideString& str) { encoded.GetLength() / sizeof(unsigned short)); return *this; } -FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { +FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, uint32_t dwSize) { if (m_LoadingPos + dwSize > m_LoadingSize) { return FALSE; } @@ -318,7 +318,7 @@ FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) { } #endif // PDF_ENABLE_XFA -void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) { +void CFX_BitStream::Init(const uint8_t* pData, uint32_t dwSize) { m_pData = pData; m_BitSize = dwSize * 8; m_BitPos = 0; @@ -330,7 +330,7 @@ void CFX_BitStream::ByteAlign() { } m_BitPos += 8 - mod; } -FX_DWORD CFX_BitStream::GetBits(FX_DWORD nBits) { +uint32_t CFX_BitStream::GetBits(uint32_t nBits) { if (nBits > m_BitSize || m_BitPos + nBits > m_BitSize) { return 0; } @@ -339,9 +339,9 @@ FX_DWORD CFX_BitStream::GetBits(FX_DWORD nBits) { m_BitPos++; return bit; } - FX_DWORD byte_pos = m_BitPos / 8; - FX_DWORD bit_pos = m_BitPos % 8, bit_left = nBits; - FX_DWORD result = 0; + uint32_t byte_pos = m_BitPos / 8; + uint32_t bit_pos = m_BitPos % 8, bit_left = nBits; + uint32_t result = 0; if (bit_pos) { if (8 - bit_pos >= bit_left) { result = @@ -412,7 +412,7 @@ int32_t CFX_FileBufferArchive::AppendByte(uint8_t byte) { return AppendBlock(&byte, 1); } -int32_t CFX_FileBufferArchive::AppendDWord(FX_DWORD i) { +int32_t CFX_FileBufferArchive::AppendDWord(uint32_t i) { char buf[32]; FXSYS_itoa(i, buf, 10); return AppendBlock(buf, (size_t)FXSYS_strlen(buf)); diff --git a/core/fxcrt/fx_basic_gcc.cpp b/core/fxcrt/fx_basic_gcc.cpp index c29c9956e2..1b2f01ec89 100644 --- a/core/fxcrt/fx_basic_gcc.cpp +++ b/core/fxcrt/fx_basic_gcc.cpp @@ -107,8 +107,8 @@ extern "C" { int FXSYS_GetACP() { return 0; } -FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, - FX_DWORD buflen, +uint32_t FXSYS_GetFullPathName(const FX_CHAR* filename, + uint32_t buflen, FX_CHAR* buf, FX_CHAR** filepart) { int srclen = FXSYS_strlen(filename); @@ -118,8 +118,8 @@ FX_DWORD FXSYS_GetFullPathName(const FX_CHAR* filename, FXSYS_strcpy(buf, filename); return srclen; } -FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize) { - return (FX_DWORD)-1; +uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) { + return (uint32_t)-1; } #ifdef __cplusplus } @@ -212,8 +212,8 @@ char* FXSYS_itoa(int value, char* str, int radix) { #ifdef __cplusplus extern "C" { #endif -int FXSYS_WideCharToMultiByte(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_WideCharToMultiByte(uint32_t codepage, + uint32_t dwFlags, const FX_WCHAR* wstr, int wlen, FX_CHAR* buf, @@ -231,8 +231,8 @@ int FXSYS_WideCharToMultiByte(FX_DWORD codepage, } return len; } -int FXSYS_MultiByteToWideChar(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_MultiByteToWideChar(uint32_t codepage, + uint32_t dwFlags, const FX_CHAR* bstr, int blen, FX_WCHAR* buf, diff --git a/core/fxcrt/fx_basic_maps.cpp b/core/fxcrt/fx_basic_maps.cpp index 935c998deb..660306b11a 100644 --- a/core/fxcrt/fx_basic_maps.cpp +++ b/core/fxcrt/fx_basic_maps.cpp @@ -28,8 +28,8 @@ CFX_MapPtrToPtr::~CFX_MapPtrToPtr() { RemoveAll(); ASSERT(m_nCount == 0); } -FX_DWORD CFX_MapPtrToPtr::HashKey(void* key) const { - return ((FX_DWORD)(uintptr_t)key) >> 4; +uint32_t CFX_MapPtrToPtr::HashKey(void* key) const { + return ((uint32_t)(uintptr_t)key) >> 4; } void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, void*& rKey, @@ -38,7 +38,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, CAssoc* pAssocRet = (CAssoc*)rNextPosition; ASSERT(pAssocRet); if (pAssocRet == (CAssoc*)-1) { - for (FX_DWORD nBucket = 0; nBucket < m_nHashTableSize; nBucket++) { + for (uint32_t nBucket = 0; nBucket < m_nHashTableSize; nBucket++) { pAssocRet = m_pHashTable[nBucket]; if (pAssocRet) break; @@ -46,7 +46,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, ASSERT(pAssocRet); } CAssoc* pAssocNext = pAssocRet->pNext; - for (FX_DWORD nBucket = (HashKey(pAssocRet->key) % m_nHashTableSize) + 1; + for (uint32_t nBucket = (HashKey(pAssocRet->key) % m_nHashTableSize) + 1; nBucket < m_nHashTableSize && !pAssocNext; nBucket++) { pAssocNext = m_pHashTable[nBucket]; } @@ -55,7 +55,7 @@ void CFX_MapPtrToPtr::GetNextAssoc(FX_POSITION& rNextPosition, rValue = pAssocRet->value; } FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { - FX_DWORD nHash; + uint32_t nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); if (!pAssoc) { return FALSE; @@ -64,7 +64,7 @@ FX_BOOL CFX_MapPtrToPtr::Lookup(void* key, void*& rValue) const { return TRUE; } void* CFX_MapPtrToPtr::GetValueAt(void* key) const { - FX_DWORD nHash; + uint32_t nHash; CAssoc* pAssoc = GetAssocAt(key, nHash); if (!pAssoc) { return NULL; @@ -72,7 +72,7 @@ void* CFX_MapPtrToPtr::GetValueAt(void* key) const { return pAssoc->value; } void*& CFX_MapPtrToPtr::operator[](void* key) { - FX_DWORD nHash; + uint32_t nHash; CAssoc* pAssoc; if ((pAssoc = GetAssocAt(key, nHash)) == NULL) { if (!m_pHashTable) { @@ -86,7 +86,7 @@ void*& CFX_MapPtrToPtr::operator[](void* key) { return pAssoc->value; } CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::GetAssocAt(void* key, - FX_DWORD& nHash) const { + uint32_t& nHash) const { nHash = HashKey(key) % m_nHashTableSize; if (!m_pHashTable) { return NULL; @@ -118,7 +118,7 @@ CFX_MapPtrToPtr::CAssoc* CFX_MapPtrToPtr::NewAssoc() { pAssoc->value = 0; return pAssoc; } -void CFX_MapPtrToPtr::InitHashTable(FX_DWORD nHashSize, FX_BOOL bAllocNow) { +void CFX_MapPtrToPtr::InitHashTable(uint32_t nHashSize, FX_BOOL bAllocNow) { ASSERT(m_nCount == 0); ASSERT(nHashSize > 0); FX_Free(m_pHashTable); diff --git a/core/fxcrt/fx_basic_plex.cpp b/core/fxcrt/fx_basic_plex.cpp index 805f059063..99cc700dbf 100644 --- a/core/fxcrt/fx_basic_plex.cpp +++ b/core/fxcrt/fx_basic_plex.cpp @@ -8,8 +8,8 @@ #include "core/fxcrt/plex.h" CFX_Plex* CFX_Plex::Create(CFX_Plex*& pHead, - FX_DWORD nMax, - FX_DWORD cbElement) { + uint32_t nMax, + uint32_t cbElement) { CFX_Plex* p = (CFX_Plex*)FX_Alloc(uint8_t, sizeof(CFX_Plex) + nMax * cbElement); p->pNext = pHead; diff --git a/core/fxcrt/fx_basic_utf.cpp b/core/fxcrt/fx_basic_utf.cpp index 08b9ca6ba6..e1996999f8 100644 --- a/core/fxcrt/fx_basic_utf.cpp +++ b/core/fxcrt/fx_basic_utf.cpp @@ -10,7 +10,7 @@ void CFX_UTF8Decoder::Clear() { m_Buffer.Clear(); m_PendingBytes = 0; } -void CFX_UTF8Decoder::AppendChar(FX_DWORD ch) { +void CFX_UTF8Decoder::AppendChar(uint32_t ch) { m_Buffer.AppendChar((FX_WCHAR)ch); } void CFX_UTF8Decoder::Input(uint8_t byte) { @@ -44,20 +44,20 @@ void CFX_UTF8Decoder::Input(uint8_t byte) { } } void CFX_UTF8Encoder::Input(FX_WCHAR unicode) { - if ((FX_DWORD)unicode < 0x80) { + if ((uint32_t)unicode < 0x80) { m_Buffer.AppendChar(unicode); } else { - if ((FX_DWORD)unicode >= 0x80000000) { + if ((uint32_t)unicode >= 0x80000000) { return; } int nbytes = 0; - if ((FX_DWORD)unicode < 0x800) { + if ((uint32_t)unicode < 0x800) { nbytes = 2; - } else if ((FX_DWORD)unicode < 0x10000) { + } else if ((uint32_t)unicode < 0x10000) { nbytes = 3; - } else if ((FX_DWORD)unicode < 0x200000) { + } else if ((uint32_t)unicode < 0x200000) { nbytes = 4; - } else if ((FX_DWORD)unicode < 0x4000000) { + } else if ((uint32_t)unicode < 0x4000000) { nbytes = 5; } else { nbytes = 6; diff --git a/core/fxcrt/fx_bidi.cpp b/core/fxcrt/fx_bidi.cpp index 30b1a6df07..d8a8f88a64 100644 --- a/core/fxcrt/fx_bidi.cpp +++ b/core/fxcrt/fx_bidi.cpp @@ -13,7 +13,7 @@ CFX_BidiChar::CFX_BidiChar() : m_CurrentSegment({0, 0, NEUTRAL}), m_LastSegment({0, 0, NEUTRAL}) {} bool CFX_BidiChar::AppendChar(FX_WCHAR wch) { - FX_DWORD dwProps = FX_GetUnicodeProperties(wch); + uint32_t dwProps = FX_GetUnicodeProperties(wch); int32_t iBidiCls = (dwProps & FX_BIDICLASSBITSMASK) >> FX_BIDICLASSBITS; Direction direction = NEUTRAL; switch (iBidiCls) { diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 99190859b8..7e8029baba 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -29,7 +29,7 @@ IFX_FileStream* CFX_CRTFileStream::Retain() { } void CFX_CRTFileStream::Release() { - FX_DWORD nCount = --m_dwCount; + uint32_t nCount = --m_dwCount; if (!nCount) { delete this; } @@ -82,7 +82,7 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { } #endif // PDF_ENABLE_XFA -IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) { +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, uint32_t dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { return NULL; @@ -94,7 +94,7 @@ IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) { return new CFX_CRTFileStream(pFA); } IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, - FX_DWORD dwModes) { + uint32_t dwModes) { IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create(); if (!pFA) { return NULL; @@ -217,7 +217,7 @@ int32_t FXSYS_strnicmp(const FX_CHAR* s1, const FX_CHAR* s2, size_t count) { } return ch1 - ch2; } -FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, +uint32_t FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr); @@ -225,7 +225,7 @@ FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, iLength = (int32_t)FXSYS_strlen(pStr); } const FX_CHAR* pStrEnd = pStr + iLength; - FX_DWORD dwHashCode = 0; + uint32_t dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { dwHashCode = 31 * dwHashCode + FXSYS_tolower(*pStr++); @@ -237,7 +237,7 @@ FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, } return dwHashCode; } -FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, +uint32_t FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase) { FXSYS_assert(pStr); @@ -245,7 +245,7 @@ FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, iLength = (int32_t)FXSYS_wcslen(pStr); } const FX_WCHAR* pStrEnd = pStr + iLength; - FX_DWORD dwHashCode = 0; + uint32_t dwHashCode = 0; if (bIgnoreCase) { while (pStr < pStrEnd) { dwHashCode = 1313 * dwHashCode + FXSYS_tolower(*pStr++); @@ -258,29 +258,29 @@ FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, return dwHashCode; } -void* FX_Random_MT_Start(FX_DWORD dwSeed) { +void* FX_Random_MT_Start(uint32_t dwSeed) { FX_MTRANDOMCONTEXT* pContext = FX_Alloc(FX_MTRANDOMCONTEXT, 1); pContext->mt[0] = dwSeed; - FX_DWORD& i = pContext->mti; - FX_DWORD* pBuf = pContext->mt; + uint32_t& i = pContext->mti; + uint32_t* 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(void* pContext) { +uint32_t FX_Random_MT_Generate(void* pContext) { FXSYS_assert(pContext); FX_MTRANDOMCONTEXT* pMTC = static_cast<FX_MTRANDOMCONTEXT*>(pContext); - FX_DWORD v; - static FX_DWORD mag[2] = {0, MT_Matrix_A}; - FX_DWORD& mti = pMTC->mti; - FX_DWORD* pBuf = pMTC->mt; + uint32_t v; + static uint32_t mag[2] = {0, MT_Matrix_A}; + uint32_t& mti = pMTC->mti; + uint32_t* pBuf = pMTC->mt; if ((int)mti < 0 || mti >= MT_N) { if (mti > MT_N && !pMTC->bHaveSeed) { return 0; } - FX_DWORD kk; + uint32_t kk; for (kk = 0; kk < MT_N - MT_M; kk++) { v = (pBuf[kk] & MT_Upper_Mask) | (pBuf[kk + 1] & MT_Lower_Mask); pBuf[kk] = pBuf[kk + MT_M] ^ (v >> 1) ^ mag[v & 1]; @@ -304,8 +304,8 @@ void FX_Random_MT_Close(void* pContext) { FXSYS_assert(pContext); FX_Free(pContext); } -void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount) { - FX_DWORD dwSeed; +void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount) { + uint32_t dwSeed; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ if (!FX_GenerateCryptoRandom(&dwSeed, 1)) { FX_Random_GenerateBase(&dwSeed, 1); @@ -319,18 +319,18 @@ void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount) { } FX_Random_MT_Close(pContext); } -void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) { +void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ SYSTEMTIME st1, st2; ::GetSystemTime(&st1); do { ::GetSystemTime(&st2); } while (FXSYS_memcmp(&st1, &st2, sizeof(SYSTEMTIME)) == 0); - FX_DWORD dwHash1 = + uint32_t dwHash1 = FX_HashCode_String_GetA((const FX_CHAR*)&st1, sizeof(st1), TRUE); - FX_DWORD dwHash2 = + uint32_t dwHash2 = FX_HashCode_String_GetA((const FX_CHAR*)&st2, sizeof(st2), TRUE); - ::srand((dwHash1 << 16) | (FX_DWORD)dwHash2); + ::srand((dwHash1 << 16) | (uint32_t)dwHash2); #else time_t tmLast = time(NULL); time_t tmCur; @@ -341,21 +341,21 @@ void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount) { ::srand((tmCur << 16) | (tmLast & 0xFFFF)); #endif while (iCount-- > 0) { - *pBuffer++ = (FX_DWORD)((::rand() << 16) | (::rand() & 0xFFFF)); + *pBuffer++ = (uint32_t)((::rand() << 16) | (::rand() & 0xFFFF)); } } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount) { +FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount) { HCRYPTPROV hCP = NULL; if (!::CryptAcquireContext(&hCP, NULL, NULL, PROV_RSA_FULL, 0) || !hCP) { return FALSE; } - ::CryptGenRandom(hCP, iCount * sizeof(FX_DWORD), (uint8_t*)pBuffer); + ::CryptGenRandom(hCP, iCount * sizeof(uint32_t), (uint8_t*)pBuffer); ::CryptReleaseContext(hCP, 0); return TRUE; } #endif -void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { +void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ FX_GenerateCryptoRandom(pBuffer, iCount); #else @@ -365,7 +365,7 @@ void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) { #ifdef PDF_ENABLE_XFA void FX_GUID_CreateV4(FX_LPGUID pGUID) { - FX_Random_GenerateMT((FX_DWORD*)pGUID, 4); + FX_Random_GenerateMT((uint32_t*)pGUID, 4); uint8_t& b = ((uint8_t*)pGUID)[6]; b = (b & 0x0F) | 0x40; } diff --git a/core/fxcrt/fx_ucddata.cpp b/core/fxcrt/fx_ucddata.cpp index 783d5653b8..1567d454f8 100644 --- a/core/fxcrt/fx_ucddata.cpp +++ b/core/fxcrt/fx_ucddata.cpp @@ -7,7 +7,7 @@ #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_ucd.h" -const FX_DWORD kTextLayoutCodeProperties[] = { +const uint32_t kTextLayoutCodeProperties[] = { 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe8ae5, 0xfffe9b5c, 0xfffe9ada, 0xfffe9b1a, 0xfffe9b5b, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, 0xfffe9a93, diff --git a/core/fxcrt/fx_unicode.cpp b/core/fxcrt/fx_unicode.cpp index 296ead84bb..d042283a32 100644 --- a/core/fxcrt/fx_unicode.cpp +++ b/core/fxcrt/fx_unicode.cpp @@ -6,7 +6,7 @@ #include "core/fxcrt/include/fx_ucd.h" -FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) { +uint32_t FX_GetUnicodeProperties(FX_WCHAR wch) { size_t idx = static_cast<size_t>(wch); if (idx < kTextLayoutCodePropertiesSize) return kTextLayoutCodeProperties[(uint16_t)wch]; @@ -15,14 +15,14 @@ FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) { #ifdef PDF_ENABLE_XFA FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) { - FX_DWORD dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK); + uint32_t dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK); return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control; } #endif // PDF_ENABLE_XFA FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) { - FX_DWORD dwProps = FX_GetUnicodeProperties(wch); - FX_DWORD dwTemp = (dwProps & 0xFF800000); + uint32_t dwProps = FX_GetUnicodeProperties(wch); + uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { size_t idx = dwTemp >> 23; if (idx < kFXTextLayoutBidiMirrorSize) { @@ -43,10 +43,10 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) { #ifdef PDF_ENABLE_XFA FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, - FX_DWORD dwProps, + uint32_t dwProps, FX_BOOL bRTL, FX_BOOL bVertical) { - FX_DWORD dwTemp = (dwProps & 0xFF800000); + uint32_t dwTemp = (dwProps & 0xFF800000); if (bRTL && dwTemp < 0xFF800000) { size_t idx = dwTemp >> 23; if (idx < kFXTextLayoutBidiMirrorSize) { diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp index 43f8c54366..9cdf73ca90 100644 --- a/core/fxcrt/fx_xml_parser.cpp +++ b/core/fxcrt/fx_xml_parser.cpp @@ -179,7 +179,7 @@ void CXML_Parser::SkipLiterals(const CFX_ByteStringC& str) { } m_dwIndex = m_dwBufferSize; } -FX_DWORD CXML_Parser::GetCharRef() { +uint32_t CXML_Parser::GetCharRef() { m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (IsEOF()) { return 0; @@ -187,7 +187,7 @@ FX_DWORD CXML_Parser::GetCharRef() { uint8_t ch; int32_t iState = 0; CFX_ByteTextBuf buf; - FX_DWORD code = 0; + uint32_t code = 0; do { while (m_dwIndex < m_dwBufferSize) { ch = m_pBuffer[m_dwIndex]; @@ -689,10 +689,10 @@ FX_BOOL CXML_Element::GetAttrFloat(const CFX_ByteStringC& space, } return FALSE; } -CXML_Element::ChildType CXML_Element::GetChildType(FX_DWORD index) const { +CXML_Element::ChildType CXML_Element::GetChildType(uint32_t index) const { return index < m_Children.size() ? m_Children[index].type : Invalid; } -CFX_WideString CXML_Element::GetContent(FX_DWORD index) const { +CFX_WideString CXML_Element::GetContent(uint32_t index) const { if (index < m_Children.size() && m_Children[index].type == Content) { CXML_Content* pContent = static_cast<CXML_Content*>(m_Children[index].child); @@ -701,13 +701,13 @@ CFX_WideString CXML_Element::GetContent(FX_DWORD index) const { } return CFX_WideString(); } -CXML_Element* CXML_Element::GetElement(FX_DWORD index) const { +CXML_Element* CXML_Element::GetElement(uint32_t index) const { if (index < m_Children.size() && m_Children[index].type == Element) { return static_cast<CXML_Element*>(m_Children[index].child); } return nullptr; } -FX_DWORD CXML_Element::CountElements(const CFX_ByteStringC& space, +uint32_t CXML_Element::CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { int count = 0; for (const ChildRecord& record : m_Children) { @@ -741,7 +741,7 @@ CXML_Element* CXML_Element::GetElement(const CFX_ByteStringC& space, } return nullptr; } -FX_DWORD CXML_Element::FindElement(CXML_Element* pChild) const { +uint32_t CXML_Element::FindElement(CXML_Element* pChild) const { int index = 0; for (const ChildRecord& record : m_Children) { if (record.type == Element && @@ -750,7 +750,7 @@ FX_DWORD CXML_Element::FindElement(CXML_Element* pChild) const { } ++index; } - return (FX_DWORD)-1; + return (uint32_t)-1; } bool CXML_AttrItem::Matches(const CFX_ByteStringC& space, diff --git a/core/fxcrt/fxcrt_platforms.cpp b/core/fxcrt/fxcrt_platforms.cpp index 4305c41874..16e1a0976d 100644 --- a/core/fxcrt/fxcrt_platforms.cpp +++ b/core/fxcrt/fxcrt_platforms.cpp @@ -15,7 +15,7 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_CRT; } -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode) { +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_ByteString& bsMode) { if (dwModes & FX_FILEMODE_ReadOnly) { bsMode = "rb"; } else if (dwModes & FX_FILEMODE_Truncate) { @@ -24,7 +24,7 @@ void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode) { bsMode = "a+b"; } } -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_WideString& wsMode) { +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_WideString& wsMode) { if (dwModes & FX_FILEMODE_ReadOnly) { wsMode = FX_WSTRC(L"rb"); } else if (dwModes & FX_FILEMODE_Truncate) { @@ -38,7 +38,7 @@ CFXCRT_FileAccess_CRT::~CFXCRT_FileAccess_CRT() { Close(); } FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } @@ -48,7 +48,7 @@ FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_ByteStringC& fileName, return m_hFile != NULL; } FX_BOOL CFXCRT_FileAccess_CRT::Open(const CFX_WideStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } diff --git a/core/fxcrt/fxcrt_platforms.h b/core/fxcrt/fxcrt_platforms.h index 6bbebcba13..736c116625 100644 --- a/core/fxcrt/fxcrt_platforms.h +++ b/core/fxcrt/fxcrt_platforms.h @@ -10,16 +10,16 @@ #include "core/fxcrt/extension.h" #if _FX_OS_ == _FX_ANDROID_ -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode); -void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_WideString& wsMode); +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_ByteString& bsMode); +void FXCRT_GetFileModeString(uint32_t dwModes, CFX_WideString& wsMode); class CFXCRT_FileAccess_CRT : public IFXCRT_FileAccess { public: CFXCRT_FileAccess_CRT(); ~CFXCRT_FileAccess_CRT() override; // IFXCRT_FileAccess - FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override; - FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override; + FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override; + FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override; void Close() override; void Release() override; FX_FILESIZE GetSize() const override; diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp index 02556c1520..2f17e71567 100644 --- a/core/fxcrt/fxcrt_posix.cpp +++ b/core/fxcrt/fxcrt_posix.cpp @@ -14,7 +14,7 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_Posix; } -void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, +void FXCRT_Posix_GetFileMode(uint32_t dwModes, int32_t& nFlags, int32_t& nMasks) { nFlags = O_BINARY | O_LARGEFILE; @@ -34,7 +34,7 @@ CFXCRT_FileAccess_Posix::~CFXCRT_FileAccess_Posix() { Close(); } FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_nFD > -1) { return FALSE; } @@ -44,7 +44,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, return m_nFD > -1; } FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { return Open(FX_UTF8Encode(fileName), dwMode); } void CFXCRT_FileAccess_Posix::Close() { diff --git a/core/fxcrt/fxcrt_posix.h b/core/fxcrt/fxcrt_posix.h index cf5f634874..969707a7b9 100644 --- a/core/fxcrt/fxcrt_posix.h +++ b/core/fxcrt/fxcrt_posix.h @@ -18,8 +18,8 @@ class CFXCRT_FileAccess_Posix : public IFXCRT_FileAccess { ~CFXCRT_FileAccess_Posix() override; // IFXCRT_FileAccess - FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override; - FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override; + FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override; + FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override; void Close() override; void Release() override; FX_FILESIZE GetSize() const override; diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp index 61c0eb6e39..340d22585f 100644 --- a/core/fxcrt/fxcrt_windows.cpp +++ b/core/fxcrt/fxcrt_windows.cpp @@ -12,10 +12,10 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { return new CFXCRT_FileAccess_Win64; } -void FXCRT_Windows_GetFileMode(FX_DWORD dwMode, - FX_DWORD& dwAccess, - FX_DWORD& dwShare, - FX_DWORD& dwCreation) { +void FXCRT_Windows_GetFileMode(uint32_t dwMode, + uint32_t& dwAccess, + uint32_t& dwShare, + uint32_t& dwCreation) { dwAccess = GENERIC_READ; dwShare = FILE_SHARE_READ | FILE_SHARE_WRITE; if (!(dwMode & FX_FILEMODE_ReadOnly)) { @@ -41,11 +41,11 @@ CFXCRT_FileAccess_Win64::~CFXCRT_FileAccess_Win64() { Close(); } FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } - FX_DWORD dwAccess, dwShare, dwCreation; + uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); m_hFile = ::CreateFileA(fileName.GetCStr(), dwAccess, dwShare, NULL, dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); @@ -55,11 +55,11 @@ FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_ByteStringC& fileName, return m_hFile != NULL; } FX_BOOL CFXCRT_FileAccess_Win64::Open(const CFX_WideStringC& fileName, - FX_DWORD dwMode) { + uint32_t dwMode) { if (m_hFile) { return FALSE; } - FX_DWORD dwAccess, dwShare, dwCreation; + uint32_t dwAccess, dwShare, dwCreation; FXCRT_Windows_GetFileMode(dwMode, dwAccess, dwShare, dwCreation); m_hFile = ::CreateFileW((LPCWSTR)fileName.GetPtr(), dwAccess, dwShare, NULL, dwCreation, FILE_ATTRIBUTE_NORMAL, NULL); diff --git a/core/fxcrt/fxcrt_windows.h b/core/fxcrt/fxcrt_windows.h index 04a1a55b16..7444446d45 100644 --- a/core/fxcrt/fxcrt_windows.h +++ b/core/fxcrt/fxcrt_windows.h @@ -16,8 +16,8 @@ class CFXCRT_FileAccess_Win64 : public IFXCRT_FileAccess { ~CFXCRT_FileAccess_Win64() override; // IFXCRT_FileAccess - FX_BOOL Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode) override; - FX_BOOL Open(const CFX_WideStringC& fileName, FX_DWORD dwMode) override; + FX_BOOL Open(const CFX_ByteStringC& fileName, uint32_t dwMode) override; + FX_BOOL Open(const CFX_WideStringC& fileName, uint32_t dwMode) override; void Close() override; void Release() override; FX_FILESIZE GetSize() const override; diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h index 4f2e83c20b..8a7afda137 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -87,7 +87,7 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf { CFX_ByteStringC GetByteString() const; CFX_ByteTextBuf& operator<<(int i); - CFX_ByteTextBuf& operator<<(FX_DWORD i); + CFX_ByteTextBuf& operator<<(uint32_t i); CFX_ByteTextBuf& operator<<(double f); CFX_ByteTextBuf& operator<<(const CFX_ByteStringC& lpsz); CFX_ByteTextBuf& operator<<(const CFX_ByteTextBuf& buf); @@ -124,7 +124,7 @@ class CFX_ArchiveSaver { CFX_ArchiveSaver& operator<<(int i); - CFX_ArchiveSaver& operator<<(FX_DWORD i); + CFX_ArchiveSaver& operator<<(uint32_t i); CFX_ArchiveSaver& operator<<(FX_FLOAT i); @@ -151,13 +151,13 @@ class CFX_ArchiveSaver { }; class CFX_ArchiveLoader { public: - CFX_ArchiveLoader(const uint8_t* pData, FX_DWORD dwSize); + CFX_ArchiveLoader(const uint8_t* pData, uint32_t dwSize); CFX_ArchiveLoader& operator>>(uint8_t& i); CFX_ArchiveLoader& operator>>(int& i); - CFX_ArchiveLoader& operator>>(FX_DWORD& i); + CFX_ArchiveLoader& operator>>(uint32_t& i); CFX_ArchiveLoader& operator>>(FX_FLOAT& i); @@ -169,14 +169,14 @@ class CFX_ArchiveLoader { FX_BOOL IsEOF(); - FX_BOOL Read(void* pBuf, FX_DWORD dwSize); + FX_BOOL Read(void* pBuf, uint32_t dwSize); protected: - FX_DWORD m_LoadingPos; + uint32_t m_LoadingPos; const uint8_t* m_pLoadingBuf; - FX_DWORD m_LoadingSize; + uint32_t m_LoadingSize; }; #endif // PDF_ENABLE_XFA @@ -189,7 +189,7 @@ class CFX_FileBufferArchive { bool Flush(); int32_t AppendBlock(const void* pBuf, size_t size); int32_t AppendByte(uint8_t byte); - int32_t AppendDWord(FX_DWORD i); + int32_t AppendDWord(uint32_t i); int32_t AppendString(const CFX_ByteStringC& lpsz); // |pFile| must outlive the CFX_FileBufferArchive. @@ -222,7 +222,7 @@ class CFX_UTF8Decoder { void Input(uint8_t byte); - void AppendChar(FX_DWORD ch); + void AppendChar(uint32_t ch); void ClearStatus() { m_PendingBytes = 0; } @@ -231,7 +231,7 @@ class CFX_UTF8Decoder { protected: int m_PendingBytes; - FX_DWORD m_PendingChar; + uint32_t m_PendingChar; CFX_WideTextBuf m_Buffer; }; @@ -631,14 +631,14 @@ class CFX_MapPtrToPtr { void*& rKey, void*& rValue) const; - FX_DWORD GetHashTableSize() const { return m_nHashTableSize; } + uint32_t GetHashTableSize() const { return m_nHashTableSize; } - void InitHashTable(FX_DWORD hashSize, FX_BOOL bAllocNow = TRUE); + void InitHashTable(uint32_t hashSize, FX_BOOL bAllocNow = TRUE); protected: CAssoc** m_pHashTable; - FX_DWORD m_nHashTableSize; + uint32_t m_nHashTableSize; int m_nCount; @@ -648,13 +648,13 @@ class CFX_MapPtrToPtr { int m_nBlockSize; - FX_DWORD HashKey(void* key) const; + uint32_t HashKey(void* key) const; CAssoc* NewAssoc(); void FreeAssoc(CAssoc* pAssoc); - CAssoc* GetAssocAt(void* key, FX_DWORD& hash) const; + CAssoc* GetAssocAt(void* key, uint32_t& hash) const; }; template <class KeyType, class ValueType> @@ -792,8 +792,8 @@ class CFX_PrivateData { if (!module_id) { return FALSE; } - FX_DWORD nCount = m_DataList.GetSize(); - for (FX_DWORD n = 0; n < nCount; n++) { + uint32_t nCount = m_DataList.GetSize(); + for (uint32_t n = 0; n < nCount; n++) { if (m_DataList[n].m_pModuleId == module_id) { pData = m_DataList[n].m_pData; return TRUE; @@ -815,28 +815,28 @@ class CFX_PrivateData { class CFX_BitStream { public: - void Init(const uint8_t* pData, FX_DWORD dwSize); + void Init(const uint8_t* pData, uint32_t dwSize); - FX_DWORD GetBits(FX_DWORD nBits); + uint32_t GetBits(uint32_t nBits); void ByteAlign(); FX_BOOL IsEOF() { return m_BitPos >= m_BitSize; } - void SkipBits(FX_DWORD nBits) { m_BitPos += nBits; } + void SkipBits(uint32_t nBits) { m_BitPos += nBits; } void Rewind() { m_BitPos = 0; } - FX_DWORD GetPos() const { return m_BitPos; } + uint32_t GetPos() const { return m_BitPos; } - FX_DWORD BitsRemaining() const { + uint32_t BitsRemaining() const { return m_BitSize >= m_BitPos ? m_BitSize - m_BitPos : 0; } protected: - FX_DWORD m_BitPos; + uint32_t m_BitPos; - FX_DWORD m_BitSize; + uint32_t m_BitSize; const uint8_t* m_pData; }; @@ -1091,8 +1091,8 @@ typedef CFX_ListArrayTemplate<CFX_SortListArray<sizeof(FX_FILESIZE)>, class IFX_Unknown { public: virtual ~IFX_Unknown() {} - virtual FX_DWORD Release() = 0; - virtual FX_DWORD AddRef() = 0; + virtual uint32_t Release() = 0; + virtual uint32_t AddRef() = 0; }; #define FX_IsOdd(a) ((a)&1) #endif // PDF_ENABLE_XFA diff --git a/core/fxcrt/include/fx_ext.h b/core/fxcrt/include/fx_ext.h index 2a39530c07..8492bc96aa 100644 --- a/core/fxcrt/include/fx_ext.h +++ b/core/fxcrt/include/fx_ext.h @@ -75,28 +75,28 @@ inline int FXSYS_toDecimalDigit(const FX_WCHAR c) { return std::iswdigit(c) ? c - L'0' : 0; } -FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, +uint32_t FX_HashCode_String_GetA(const FX_CHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); -FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, +uint32_t FX_HashCode_String_GetW(const FX_WCHAR* pStr, int32_t iLength, FX_BOOL bIgnoreCase = FALSE); -void* FX_Random_MT_Start(FX_DWORD dwSeed); +void* FX_Random_MT_Start(uint32_t dwSeed); -FX_DWORD FX_Random_MT_Generate(void* pContext); +uint32_t FX_Random_MT_Generate(void* pContext); void FX_Random_MT_Close(void* pContext); -void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); +void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount); -void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); +void FX_Random_GenerateMT(uint32_t* pBuffer, int32_t iCount); -void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); +void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount); #ifdef PDF_ENABLE_XFA typedef struct FX_GUID { - FX_DWORD data1; + uint32_t data1; uint16_t data2; uint16_t data3; uint8_t data4[8]; diff --git a/core/fxcrt/include/fx_safe_types.h b/core/fxcrt/include/fx_safe_types.h index 47eb55ddd5..84ea55a685 100644 --- a/core/fxcrt/include/fx_safe_types.h +++ b/core/fxcrt/include/fx_safe_types.h @@ -11,7 +11,7 @@ #include "core/fxcrt/include/fx_system.h" #include "third_party/base/numerics/safe_math.h" -typedef pdfium::base::CheckedNumeric<FX_DWORD> FX_SAFE_DWORD; +typedef pdfium::base::CheckedNumeric<uint32_t> FX_SAFE_DWORD; typedef pdfium::base::CheckedNumeric<int32_t> FX_SAFE_INT32; typedef pdfium::base::CheckedNumeric<size_t> FX_SAFE_SIZE_T; typedef pdfium::base::CheckedNumeric<FX_FILESIZE> FX_SAFE_FILESIZE; diff --git a/core/fxcrt/include/fx_stream.h b/core/fxcrt/include/fx_stream.h index 4b77796821..ba72994f36 100644 --- a/core/fxcrt/include/fx_stream.h +++ b/core/fxcrt/include/fx_stream.h @@ -114,8 +114,8 @@ class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite { FX_BOOL Flush() override = 0; }; -IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes); -IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, FX_DWORD dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, uint32_t dwModes); +IFX_FileStream* FX_CreateFileStream(const FX_WCHAR* filename, uint32_t dwModes); #ifdef PDF_ENABLE_XFA class IFX_FileAccess { @@ -124,7 +124,7 @@ class IFX_FileAccess { virtual void Release() = 0; virtual IFX_FileAccess* Retain() = 0; virtual void GetPath(CFX_WideString& wsPath) = 0; - virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 0; + virtual IFX_FileStream* CreateFileStream(uint32_t dwModes) = 0; }; IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath); #endif // PDF_ENABLE_XFA diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index 4bca083dd0..e5f9466b21 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -89,7 +89,7 @@ class CFX_ByteStringC { return !(*this == other); } - FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; + uint32_t GetID(FX_STRSIZE start_pos = 0) const; const uint8_t* GetPtr() const { return m_Ptr; } @@ -296,13 +296,13 @@ class CFX_ByteString { CFX_WideString UTF8Decode() const; - FX_DWORD GetID(FX_STRSIZE start_pos = 0) const; + uint32_t GetID(FX_STRSIZE start_pos = 0) const; #define FXFORMAT_SIGNED 1 #define FXFORMAT_HEX 2 #define FXFORMAT_CAPITAL 4 - static CFX_ByteString FormatInteger(int i, FX_DWORD flags = 0); + static CFX_ByteString FormatInteger(int i, uint32_t flags = 0); static CFX_ByteString FormatFloat(FX_FLOAT f, int precision = 0); protected: diff --git a/core/fxcrt/include/fx_system.h b/core/fxcrt/include/fx_system.h index 1d51aec543..22fdef2014 100644 --- a/core/fxcrt/include/fx_system.h +++ b/core/fxcrt/include/fx_system.h @@ -68,7 +68,6 @@ extern "C" { #endif typedef void* FX_POSITION; // Keep until fxcrt containers gone -typedef uint32_t FX_DWORD; // Keep - "an efficient type" typedef float FX_FLOAT; // Keep, allow upgrade to doubles. typedef double FX_DOUBLE; // Keep, allow downgrade to floats. typedef int FX_BOOL; // Keep, sadly not always 0 or 1. @@ -209,25 +208,25 @@ extern "C" { #else int FXSYS_GetACP(void); char* FXSYS_itoa(int value, char* str, int radix); -int FXSYS_WideCharToMultiByte(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_WideCharToMultiByte(uint32_t codepage, + uint32_t dwFlags, const wchar_t* wstr, int wlen, char* buf, int buflen, const char* default_str, int* pUseDefault); -int FXSYS_MultiByteToWideChar(FX_DWORD codepage, - FX_DWORD dwFlags, +int FXSYS_MultiByteToWideChar(uint32_t codepage, + uint32_t dwFlags, const char* bstr, int blen, wchar_t* buf, int buflen); -FX_DWORD FXSYS_GetFullPathName(const char* filename, - FX_DWORD buflen, +uint32_t FXSYS_GetFullPathName(const char* filename, + uint32_t buflen, char* buf, char** filepart); -FX_DWORD FXSYS_GetModuleFileName(void* hModule, char* buf, FX_DWORD bufsize); +uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize); char* FXSYS_strlwr(char* str); char* FXSYS_strupr(char* str); int FXSYS_stricmp(const char*, const char*); @@ -254,11 +253,11 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_fmod(a, b) (FX_FLOAT) fmod(a, b) #define FXSYS_abs abs #define FXDWORD_GET_LSBFIRST(p) \ - ((static_cast<FX_DWORD>(p[3]) << 24) | (static_cast<FX_DWORD>(p[2]) << 16) | \ - (static_cast<FX_DWORD>(p[1]) << 8) | (static_cast<FX_DWORD>(p[0]))) + ((static_cast<uint32_t>(p[3]) << 24) | (static_cast<uint32_t>(p[2]) << 16) | \ + (static_cast<uint32_t>(p[1]) << 8) | (static_cast<uint32_t>(p[0]))) #define FXDWORD_GET_MSBFIRST(p) \ - ((static_cast<FX_DWORD>(p[0]) << 24) | (static_cast<FX_DWORD>(p[1]) << 16) | \ - (static_cast<FX_DWORD>(p[2]) << 8) | (static_cast<FX_DWORD>(p[3]))) + ((static_cast<uint32_t>(p[0]) << 24) | (static_cast<uint32_t>(p[1]) << 16) | \ + (static_cast<uint32_t>(p[2]) << 8) | (static_cast<uint32_t>(p[3]))) #define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) #define FXSYS_LOBYTE(word) ((uint8_t)(word)) #define FXSYS_HIWORD(dword) ((uint16_t)((dword) >> 16)) diff --git a/core/fxcrt/include/fx_ucd.h b/core/fxcrt/include/fx_ucd.h index f2e4215aa8..90f89486f1 100644 --- a/core/fxcrt/include/fx_ucd.h +++ b/core/fxcrt/include/fx_ucd.h @@ -35,7 +35,7 @@ enum FX_BIDICLASS { FX_BIDICLASS_N = FX_BIDICLASS_ON, }; -extern const FX_DWORD kTextLayoutCodeProperties[]; +extern const uint32_t kTextLayoutCodeProperties[]; extern const size_t kTextLayoutCodePropertiesSize; extern const uint16_t kFXTextLayoutVerticalMirror[]; @@ -44,7 +44,7 @@ extern const size_t kFXTextLayoutVerticalMirrorSize; extern const uint16_t kFXTextLayoutBidiMirror[]; extern const size_t kFXTextLayoutBidiMirrorSize; -FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch); +uint32_t FX_GetUnicodeProperties(FX_WCHAR wch); FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical); #ifdef PDF_ENABLE_XFA @@ -110,7 +110,7 @@ enum FX_CHARTYPE { FX_BOOL FX_IsCtrlCode(FX_WCHAR ch); FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, - FX_DWORD dwProps, + uint32_t dwProps, FX_BOOL bRTL, FX_BOOL bVertical); class CFX_Char { @@ -124,7 +124,7 @@ class CFX_Char { m_iCharWidth(0), m_iHorizontalScale(100), m_iVertialScale(100) {} - CFX_Char(uint16_t wCharCode, FX_DWORD dwCharProps) + CFX_Char(uint16_t wCharCode, uint32_t dwCharProps) : m_wCharCode(wCharCode), m_nBreakType(0), m_nRotation(0), @@ -133,12 +133,12 @@ class CFX_Char { m_iCharWidth(0), m_iHorizontalScale(100), m_iVertialScale(100) {} - FX_DWORD GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } + uint32_t GetCharType() const { return m_dwCharProps & FX_CHARTYPEBITSMASK; } uint16_t m_wCharCode; uint8_t m_nBreakType; int8_t m_nRotation; - FX_DWORD m_dwCharProps; - FX_DWORD m_dwCharStyles; + uint32_t m_dwCharProps; + uint32_t m_dwCharStyles; int32_t m_iCharWidth; int32_t m_iHorizontalScale; int32_t m_iVertialScale; @@ -154,7 +154,7 @@ class CFX_TxtChar : public CFX_Char { m_iBidiPos(0), m_iBidiOrder(0), m_pUserData(NULL) {} - FX_DWORD m_dwStatus; + uint32_t m_dwStatus; int16_t m_iBidiClass; int16_t m_iBidiLevel; int16_t m_iBidiPos; @@ -175,15 +175,15 @@ class CFX_RTFChar : public CFX_Char { m_dwLayoutStyles(0), m_dwIdentity(0), m_pUserData(NULL) {} - FX_DWORD m_dwStatus; + uint32_t m_dwStatus; int32_t m_iFontSize; int32_t m_iFontHeight; int16_t m_iBidiClass; int16_t m_iBidiLevel; int16_t m_iBidiPos; int16_t m_iBidiOrder; - FX_DWORD m_dwLayoutStyles; - FX_DWORD m_dwIdentity; + uint32_t m_dwLayoutStyles; + uint32_t m_dwIdentity; IFX_Unknown* m_pUserData; }; typedef CFX_ArrayTemplate<CFX_RTFChar> CFX_RTFCharArray; diff --git a/core/fxcrt/include/fx_xml.h b/core/fxcrt/include/fx_xml.h index 66add1befc..3e22883c7f 100644 --- a/core/fxcrt/include/fx_xml.h +++ b/core/fxcrt/include/fx_xml.h @@ -71,7 +71,7 @@ class CXML_Element { CFX_ByteString GetNamespace(FX_BOOL bQualified = FALSE) const; CFX_ByteString GetNamespaceURI(const CFX_ByteStringC& qName) const; CXML_Element* GetParent() const { return m_pParent; } - FX_DWORD CountAttrs() const { return m_AttrMap.GetSize(); } + uint32_t CountAttrs() const { return m_AttrMap.GetSize(); } void GetAttrByIndex(int index, CFX_ByteString& space, CFX_ByteString& name, @@ -129,26 +129,26 @@ class CXML_Element { return attr; } - FX_DWORD CountChildren() const { return m_Children.size(); } - ChildType GetChildType(FX_DWORD index) const; - CFX_WideString GetContent(FX_DWORD index) const; - CXML_Element* GetElement(FX_DWORD index) const; + uint32_t CountChildren() const { return m_Children.size(); } + ChildType GetChildType(uint32_t index) const; + CFX_WideString GetContent(uint32_t index) const; + CXML_Element* GetElement(uint32_t index) const; CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const { return GetElement(space, tag, 0); } - FX_DWORD CountElements(const CFX_ByteStringC& space, + uint32_t CountElements(const CFX_ByteStringC& space, const CFX_ByteStringC& tag) const; CXML_Element* GetElement(const CFX_ByteStringC& space, const CFX_ByteStringC& tag, int index) const; - FX_DWORD FindElement(CXML_Element* pChild) const; + uint32_t FindElement(CXML_Element* pChild) const; void SetTag(const CFX_ByteStringC& qSpace, const CFX_ByteStringC& tagname); void SetTag(const CFX_ByteStringC& qTagName); void RemoveChildren(); - void RemoveChild(FX_DWORD index); + void RemoveChild(uint32_t index); protected: struct ChildRecord { diff --git a/core/fxcrt/plex.h b/core/fxcrt/plex.h index 8bb9607268..5391566d7b 100644 --- a/core/fxcrt/plex.h +++ b/core/fxcrt/plex.h @@ -12,7 +12,7 @@ struct CFX_Plex { CFX_Plex* pNext; void* data() { return this + 1; } - static CFX_Plex* Create(CFX_Plex*& head, FX_DWORD nMax, FX_DWORD cbElement); + static CFX_Plex* Create(CFX_Plex*& head, uint32_t nMax, uint32_t cbElement); void FreeDataChain(); }; diff --git a/core/fxcrt/xml_int.h b/core/fxcrt/xml_int.h index 9a2c28c11f..2dae7b5231 100644 --- a/core/fxcrt/xml_int.h +++ b/core/fxcrt/xml_int.h @@ -110,7 +110,7 @@ class CXML_Parser { void SkipWhiteSpaces(); void GetName(CFX_ByteString& space, CFX_ByteString& name); void GetAttrValue(CFX_WideString& value); - FX_DWORD GetCharRef(); + uint32_t GetCharRef(); void GetTagName(CFX_ByteString& space, CFX_ByteString& name, FX_BOOL& bEndTag, diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index cd72865421..8bda709c26 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -233,7 +233,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { return FALSE; @@ -384,7 +384,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke( class CFX_Renderer { private: int m_Alpha, m_Red, m_Green, m_Blue, m_Gray; - FX_DWORD m_Color; + uint32_t m_Color; FX_BOOL m_bFullCover; FX_BOOL m_bRgbByteOrder; CFX_DIBitmap* m_pOriDevice; @@ -746,7 +746,7 @@ class CFX_Renderer { } if (src_alpha) { if (src_alpha == 255) { - *(FX_DWORD*)dest_scan = m_Color; + *(uint32_t*)dest_scan = m_Color; } else { uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255; @@ -782,7 +782,7 @@ class CFX_Renderer { } if (src_alpha) { if (src_alpha == 255) { - *(FX_DWORD*)dest_scan = m_Color; + *(uint32_t*)dest_scan = m_Color; } else { if (dest_scan[3] == 0) { dest_scan[3] = src_alpha; @@ -834,7 +834,7 @@ class CFX_Renderer { if (src_alpha) { if (src_alpha == 255) { if (Bpp == 4) { - *(FX_DWORD*)dest_scan = m_Color; + *(uint32_t*)dest_scan = m_Color; } else if (Bpp == 3) { *dest_scan++ = m_Red; *dest_scan++ = m_Green; @@ -914,7 +914,7 @@ class CFX_Renderer { if (src_alpha) { if (src_alpha == 255) { if (Bpp == 4) { - *(FX_DWORD*)dest_scan = m_Color; + *(uint32_t*)dest_scan = m_Color; } else if (Bpp == 3) { *dest_scan++ = m_Blue; *dest_scan++ = m_Green; @@ -1081,7 +1081,7 @@ class CFX_Renderer { FX_BOOL Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, - FX_DWORD color, + uint32_t color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder, int alpha_flag = 0, @@ -1211,7 +1211,7 @@ class CFX_Renderer { FX_BOOL CFX_AggDeviceDriver::RenderRasterizer( agg::rasterizer_scanline_aa& rasterizer, - FX_DWORD color, + uint32_t color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, int alpha_flag, @@ -1231,8 +1231,8 @@ FX_BOOL CFX_AggDeviceDriver::RenderRasterizer( FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, @@ -1312,7 +1312,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, return TRUE; } -void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb) { +void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, uint32_t argb) { if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight()) { return; } @@ -1351,7 +1351,7 @@ void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp; if (Bpp == 4) { - FX_DWORD* scan = (FX_DWORD*)dest_scan; + uint32_t* scan = (uint32_t*)dest_scan; for (int col = 0; col < width; col++) { *scan++ = dib_argb; } @@ -1523,7 +1523,7 @@ FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) { FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { FX_BOOL bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag); @@ -1558,7 +1558,7 @@ FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { if (!m_pBitmap->GetBuffer()) { @@ -1604,7 +1604,7 @@ FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, } FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag, void* pIccTransform, int blend_type) { @@ -1704,7 +1704,7 @@ FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, } FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD argb, + uint32_t argb, const FX_RECT* pSrcRect, int left, int top, @@ -1725,13 +1725,13 @@ FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, } FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, - FX_DWORD argb, + uint32_t argb, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) { @@ -1764,9 +1764,9 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, - FX_DWORD argb, + uint32_t argb, const CFX_Matrix* pMatrix, - FX_DWORD render_flags, + uint32_t render_flags, void*& handle, int alpha_flag, void* pIccTransform, diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index 2b6b6683f6..5bc9283b03 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -50,19 +50,19 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) override; FX_BOOL SetPixel(int x, int y, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) override; FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag, void* pIccTransform, int blend_type) override; @@ -70,7 +70,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform, int blend_type) override { @@ -84,7 +84,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL bDEdge = FALSE) override; CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; } FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int left, int top, @@ -92,21 +92,21 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { int alpha_flag, void* pIccTransform) override; FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) override; FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, void*& handle, int alpha_flag, void* pIccTransform, @@ -119,13 +119,13 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) override; int GetDriverType() const override { return 1; } FX_BOOL RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, - FX_DWORD color, + uint32_t color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout, int alpha_flag, diff --git a/core/fxge/android/fpf_skiafont.cpp b/core/fxge/android/fpf_skiafont.cpp index 58b937f3d4..bd9b549e99 100644 --- a/core/fxge/android/fpf_skiafont.cpp +++ b/core/fxge/android/fpf_skiafont.cpp @@ -167,9 +167,9 @@ int32_t CFPF_SkiaFont::GetItalicAngle() const { } return 0; } -FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, +uint32_t CFPF_SkiaFont::GetFontData(uint32_t dwTable, uint8_t* pBuffer, - FX_DWORD dwSize) { + uint32_t dwSize) { if (!m_Face) { return 0; } @@ -177,12 +177,12 @@ FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, if (FXFT_Load_Sfnt_Table(m_Face, dwTable, 0, pBuffer, &ulSize)) { return 0; } - return pdfium::base::checked_cast<FX_DWORD>(ulSize); + return pdfium::base::checked_cast<uint32_t>(ulSize); } FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr* pFontMgr, CFPF_SkiaFontDescriptor* pFontDes, const CFX_ByteStringC& bsFamily, - FX_DWORD dwStyle, + uint32_t dwStyle, uint8_t uCharset) { if (!pFontMgr || !pFontDes) { return FALSE; diff --git a/core/fxge/android/fpf_skiafont.h b/core/fxge/android/fpf_skiafont.h index d077f38606..9e35c942d3 100644 --- a/core/fxge/android/fpf_skiafont.h +++ b/core/fxge/android/fpf_skiafont.h @@ -27,7 +27,7 @@ class CFPF_SkiaFont : public IFPF_Font { FPF_HFONT GetHandle() override; CFX_ByteString GetFamilyName() override; CFX_WideString GetPsName() override; - FX_DWORD GetFontStyle() const override { return m_dwStyle; } + uint32_t GetFontStyle() const override { return m_dwStyle; } uint8_t GetCharset() const override { return m_uCharset; } int32_t GetGlyphIndex(FX_WCHAR wUnicode) override; int32_t GetGlyphWidth(int32_t iGlyphIndex) override; @@ -37,23 +37,23 @@ class CFPF_SkiaFont : public IFPF_Font { FX_BOOL GetBBox(FX_RECT& rtBBox) override; int32_t GetHeight() const override; int32_t GetItalicAngle() const override; - FX_DWORD GetFontData(FX_DWORD dwTable, + uint32_t GetFontData(uint32_t dwTable, uint8_t* pBuffer, - FX_DWORD dwSize) override; + uint32_t dwSize) override; FX_BOOL InitFont(CFPF_SkiaFontMgr* pFontMgr, CFPF_SkiaFontDescriptor* pFontDes, const CFX_ByteStringC& bsFamily, - FX_DWORD dwStyle, + uint32_t dwStyle, uint8_t uCharset); protected: CFPF_SkiaFontMgr* m_pFontMgr; CFPF_SkiaFontDescriptor* m_pFontDes; FXFT_Face m_Face; - FX_DWORD m_dwStyle; + uint32_t m_dwStyle; uint8_t m_uCharset; - FX_DWORD m_dwRefCount; + uint32_t m_dwRefCount; }; #endif diff --git a/core/fxge/android/fpf_skiafontmgr.cpp b/core/fxge/android/fpf_skiafontmgr.cpp index 13d030cf26..c9748da859 100644 --- a/core/fxge/android/fpf_skiafontmgr.cpp +++ b/core/fxge/android/fpf_skiafontmgr.cpp @@ -42,8 +42,8 @@ static void FPF_SkiaStream_Close(FXFT_Stream stream) {} }; #endif struct FPF_SKIAFONTMAP { - FX_DWORD dwFamily; - FX_DWORD dwSubSt; + uint32_t dwFamily; + uint32_t dwSubSt; }; static const FPF_SKIAFONTMAP g_SkiaFontmap[] = { {0x58c5083, 0xc8d2e345}, {0x5dfade2, 0xe1633081}, @@ -58,7 +58,7 @@ static const FPF_SKIAFONTMAP g_SkiaFontmap[] = { {0xcad5eaf6, 0x59b9f8f1}, {0xcb7a04c8, 0xc8d2e345}, {0xfb4ce0de, 0xe1633081}, }; -FX_DWORD FPF_SkiaGetSubstFont(FX_DWORD dwHash) { +uint32_t FPF_SkiaGetSubstFont(uint32_t dwHash) { int32_t iStart = 0; int32_t iEnd = sizeof(g_SkiaFontmap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { @@ -79,7 +79,7 @@ static const FPF_SKIAFONTMAP g_SkiaSansFontMap[] = { {0x779ce19d, 0xd5b8d10f}, {0xcb7a04c8, 0xd5b8d10f}, {0xfb4ce0de, 0xd5b8d10f}, }; -FX_DWORD FPF_SkiaGetSansFont(FX_DWORD dwHash) { +uint32_t FPF_SkiaGetSansFont(uint32_t dwHash) { int32_t iStart = 0; int32_t iEnd = sizeof(g_SkiaSansFontMap) / sizeof(FPF_SKIAFONTMAP); while (iStart <= iEnd) { @@ -138,7 +138,7 @@ enum FPF_SKIACHARSET { FPF_SKIACHARSET_PC = 1 << 17, FPF_SKIACHARSET_OEM = 1 << 18, }; -static FX_DWORD FPF_SkiaGetCharset(uint8_t uCharset) { +static uint32_t FPF_SkiaGetCharset(uint8_t uCharset) { switch (uCharset) { case FXFONT_ANSI_CHARSET: return FPF_SKIACHARSET_Ansi; @@ -173,8 +173,8 @@ static FX_DWORD FPF_SkiaGetCharset(uint8_t uCharset) { } return FPF_SKIACHARSET_Default; } -static FX_DWORD FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { - FX_DWORD dwHash = 0; +static uint32_t FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { + uint32_t dwHash = 0; int32_t iLength = bsfamily.GetLength(); const FX_CHAR* pBuffer = bsfamily.GetCStr(); for (int32_t i = 0; i < iLength; i++) { @@ -186,8 +186,8 @@ static FX_DWORD FPF_SKIANormalizeFontName(const CFX_ByteStringC& bsfamily) { } return dwHash; } -static FX_DWORD FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily, - FX_DWORD dwStyle, +static uint32_t FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily, + uint32_t dwStyle, uint8_t uCharset) { CFX_ByteString bsFont(bsFamily); if (dwStyle & FXFONT_BOLD) { @@ -252,16 +252,16 @@ void CFPF_SkiaFontMgr::LoadPrivateFont(const CFX_ByteStringC& bsFileName) {} void CFPF_SkiaFontMgr::LoadPrivateFont(void* pBuffer, size_t szBuffer) {} IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, uint8_t uCharset, - FX_DWORD dwStyle, - FX_DWORD dwMatch) { - FX_DWORD dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset); + uint32_t dwStyle, + uint32_t dwMatch) { + uint32_t dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset); auto it = m_FamilyFonts.find(dwHash); if (it != m_FamilyFonts.end() && it->second) return it->second->Retain(); - FX_DWORD dwFaceName = FPF_SKIANormalizeFontName(bsFamilyname); - FX_DWORD dwSubst = FPF_SkiaGetSubstFont(dwFaceName); - FX_DWORD dwSubstSans = FPF_SkiaGetSansFont(dwFaceName); + uint32_t dwFaceName = FPF_SKIANormalizeFontName(bsFamilyname); + uint32_t dwSubst = FPF_SkiaGetSubstFont(dwFaceName); + uint32_t dwSubstSans = FPF_SkiaGetSansFont(dwFaceName); FX_BOOL bMaybeSymbol = FPF_SkiaMaybeSymbol(bsFamilyname); if (uCharset != FXFONT_ARABIC_CHARSET && FPF_SkiaMaybeArabic(bsFamilyname)) { uCharset = FXFONT_ARABIC_CHARSET; @@ -280,7 +280,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, continue; } int32_t nFind = 0; - FX_DWORD dwSysFontName = FPF_SKIANormalizeFontName(pFontDes->m_pFamily); + uint32_t dwSysFontName = FPF_SKIANormalizeFontName(pFontDes->m_pFamily); if (dwFaceName == dwSysFontName) { nFind += FPF_SKIAMATCHWEIGHT_NAME1; } @@ -440,7 +440,7 @@ void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteStringC& file) { FXFT_Done_Face(face); } } -static const FX_DWORD g_FPFSkiaFontCharsets[] = { +static const uint32_t g_FPFSkiaFontCharsets[] = { FPF_SKIACHARSET_Ansi, FPF_SKIACHARSET_EeasternEuropean, FPF_SKIACHARSET_Cyrillic, @@ -474,8 +474,8 @@ static const FX_DWORD g_FPFSkiaFontCharsets[] = { FPF_SKIACHARSET_OEM, FPF_SKIACHARSET_Symbol, }; -static FX_DWORD FPF_SkiaGetFaceCharset(TT_OS2* pOS2) { - FX_DWORD dwCharset = 0; +static uint32_t FPF_SkiaGetFaceCharset(TT_OS2* pOS2) { + uint32_t dwCharset = 0; if (pOS2) { for (int32_t i = 0; i < 32; i++) { if (pOS2->ulCodePageRange1 & (1 << i)) { diff --git a/core/fxge/android/fpf_skiafontmgr.h b/core/fxge/android/fpf_skiafontmgr.h index 5ba5b16475..5ed409cccc 100644 --- a/core/fxge/android/fpf_skiafontmgr.h +++ b/core/fxge/android/fpf_skiafontmgr.h @@ -44,9 +44,9 @@ class CFPF_SkiaFontDescriptor { m_pFamily[iSize] = 0; } FX_CHAR* m_pFamily; - FX_DWORD m_dwStyle; + uint32_t m_dwStyle; int32_t m_iFaceIndex; - FX_DWORD m_dwCharsets; + uint32_t m_dwCharsets; int32_t m_iGlyphNum; }; @@ -100,8 +100,8 @@ class CFPF_SkiaFontMgr : public IFPF_FontMgr { void LoadPrivateFont(void* pBuffer, size_t szBuffer) override; IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, uint8_t uCharset, - FX_DWORD dwStyle, - FX_DWORD dwMatch = 0) override; + uint32_t dwStyle, + uint32_t dwMatch = 0) override; FX_BOOL InitFTLibrary(); FXFT_Face GetFontFace(IFX_FileRead* pFileRead, int32_t iFaceIndex = 0); @@ -119,7 +119,7 @@ class CFPF_SkiaFontMgr : public IFPF_FontMgr { FX_BOOL m_bLoaded; FXFT_Library m_FTLibrary; std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces; - std::map<FX_DWORD, CFPF_SkiaFont*> m_FamilyFonts; + std::map<uint32_t, CFPF_SkiaFont*> m_FamilyFonts; }; #endif diff --git a/core/fxge/android/fx_android_font.cpp b/core/fxge/android/fx_android_font.cpp index 7218b5e7d0..d663ac0f4f 100644 --- a/core/fxge/android/fx_android_font.cpp +++ b/core/fxge/android/fx_android_font.cpp @@ -32,7 +32,7 @@ void* CFX_AndroidFontInfo::MapFont(int weight, if (!m_pFontMgr) { return NULL; } - FX_DWORD dwStyle = 0; + uint32_t dwStyle = 0; if (weight >= 700) { dwStyle |= FXFONT_BOLD; } @@ -54,10 +54,10 @@ void* CFX_AndroidFontInfo::MapFont(int weight, void* CFX_AndroidFontInfo::GetFont(const FX_CHAR* face) { return NULL; } -FX_DWORD CFX_AndroidFontInfo::GetFontData(void* hFont, - FX_DWORD table, +uint32_t CFX_AndroidFontInfo::GetFontData(void* hFont, + uint32_t table, uint8_t* buffer, - FX_DWORD size) { + uint32_t size) { if (!hFont) { return 0; } diff --git a/core/fxge/android/fx_android_font.h b/core/fxge/android/fx_android_font.h index 1ce4694f77..ee8859185e 100644 --- a/core/fxge/android/fx_android_font.h +++ b/core/fxge/android/fx_android_font.h @@ -30,10 +30,10 @@ class CFX_AndroidFontInfo : public IFX_SystemFontInfo { int& bExact); virtual void* GetFont(const FX_CHAR* face); - virtual FX_DWORD GetFontData(void* hFont, - FX_DWORD table, + virtual uint32_t GetFontData(void* hFont, + uint32_t table, uint8_t* buffer, - FX_DWORD size); + uint32_t size); virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); virtual FX_BOOL GetFontCharset(void* hFont, int& charset); diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index c4f95d6d26..66d1daf73d 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h @@ -43,17 +43,17 @@ typedef enum eFXIOSFONTFLAG { eFXFontFlagScript = 1 << 4, } FX_IOSFONTFLAG; typedef struct IOS_FONTDATA_ { - FX_DWORD nHashCode; + uint32_t nHashCode; const char* psName; - FX_DWORD charsets; - FX_DWORD styles; + uint32_t charsets; + uint32_t styles; } IOS_FONTDATA; class CQuartz2D { public: void* createGraphics(CFX_DIBitmap* bitmap); void destroyGraphics(void* graphics); - void* CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize); + void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize); void DestroyFont(void* pFont); void setGraphicsTextMatrix(void* graphics, CFX_Matrix* matrix); FX_BOOL drawGraphicsString(void* graphics, @@ -97,21 +97,21 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override; FX_BOOL SetPixel(int x, int y, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL) override { return FALSE; } FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override; @@ -119,7 +119,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override; @@ -131,7 +131,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL bDEdge = FALSE) override; CFX_DIBitmap* GetBackDrop() override { return NULL; } FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int dest_left, int dest_top, @@ -139,21 +139,21 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { int alpha_flag = 0, void* pIccTransform = NULL) override; FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override; FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, @@ -170,7 +170,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL) override; void* GetPlatformSurface() const override { return NULL; } @@ -191,7 +191,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver { const CFX_Matrix* pGlyphMatrix, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD argb, + uint32_t argb, int alpha_flag, void* pIccTransform); void CG_SetImageTransform(int dest_left, @@ -263,7 +263,7 @@ class CFX_FontProvider final : public IFX_FileRead { }; uint32_t FX_GetHashCode(const FX_CHAR* pStr); -FX_DWORD FX_IOSGetMatchFamilyNameHashcode(const FX_CHAR* pFontName); +uint32_t FX_IOSGetMatchFamilyNameHashcode(const FX_CHAR* pFontName); uint32_t FX_IOSGetFamilyNamesCount(); const FX_CHAR* FX_IOSGetFamilyName(uint32_t uIndex); #endif diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index 33dfbbc05c..9683b5c6f4 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -33,7 +33,7 @@ void CFX_FaceCache::InitPlatform() {} void CFX_FaceCache::DestroyPlatform() {} CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext( CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, const CFX_Matrix* pMatrix, int dest_width, int anti_alias) { @@ -46,7 +46,7 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext, CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD argb, + uint32_t argb, int alpha_flag, void* pIccTransform) { if (nChars == 0) { @@ -103,7 +103,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD argb, + uint32_t argb, int alpha_flag, void* pIccTransform) { if (!pFont) { diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index dae396f7fe..b525660b7b 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -43,7 +43,7 @@ void CQuartz2D::destroyGraphics(void* graphics) { CGContextRelease((CGContextRef)graphics); } } -void* CQuartz2D::CreateFont(const uint8_t* pFontData, FX_DWORD dwFontSize) { +void* CQuartz2D::CreateFont(const uint8_t* pFontData, uint32_t dwFontSize) { CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(NULL, pFontData, (size_t)dwFontSize, NULL); if (NULL == pDataProvider) { @@ -337,8 +337,8 @@ static CGBlendMode GetCGBlendMode(int blend_type) { FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData, const CFX_Matrix* matrix, const CFX_GraphStateData* graphState, - FX_DWORD fillArgb, - FX_DWORD strokeArgb, + uint32_t fillArgb, + uint32_t strokeArgb, int fillMode, int alpha_flag, void* pIccTransform, @@ -414,7 +414,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD argb, + uint32_t argb, int alphaFlag, void* iccTransform, int blend_type) { @@ -636,7 +636,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap, int dest_width, int dest_height, const FX_RECT* clipRect, - FX_DWORD flags, + uint32_t flags, int alphaFlag, void* iccTransform, int blend_type) { @@ -742,7 +742,7 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars, const CFX_Matrix* pGlyphMatrix, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD argb, + uint32_t argb, int alpha_flag, void* pIccTransform) { if (nChars == 0) { @@ -807,7 +807,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars, CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { if (NULL == pFont || NULL == _context) { diff --git a/core/fxge/dib/dib_int.h b/core/fxge/dib/dib_int.h index 7022ec99ce..1d2193e9bb 100644 --- a/core/fxge/dib/dib_int.h +++ b/core/fxge/dib/dib_int.h @@ -82,7 +82,7 @@ class CStretchEngine { uint8_t* m_pDestMaskScanline; FX_RECT m_SrcClip; const CFX_DIBSource* m_pSource; - FX_DWORD* m_pSrcPalette; + uint32_t* m_pSrcPalette; int m_SrcWidth, m_SrcHeight; int m_SrcPitch, m_InterPitch; int m_ExtraMaskPitch; diff --git a/core/fxge/dib/fx_dib_composite.cpp b/core/fxge/dib/fx_dib_composite.cpp index 5bfe46e572..b10180deae 100644 --- a/core/fxge/dib/fx_dib_composite.cpp +++ b/core/fxge/dib/fx_dib_composite.cpp @@ -2149,7 +2149,7 @@ inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, } inline void _CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, - FX_DWORD* pPalette, + uint32_t* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_scan, @@ -2217,7 +2217,7 @@ inline void _CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan, inline void _CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, - FX_DWORD* pPalette, + uint32_t* pPalette, int pixel_count, int DestBpp, const uint8_t* clip_scan) { @@ -2260,7 +2260,7 @@ inline void _CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan, inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, - FX_DWORD* pPalette, + uint32_t* pPalette, const uint8_t* clip_scan, const uint8_t* src_alpha_scan) { if (src_alpha_scan) { @@ -2345,7 +2345,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int width, - FX_DWORD* pPalette, + uint32_t* pPalette, const uint8_t* clip_scan, uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { @@ -2433,7 +2433,7 @@ inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, - FX_DWORD* pPalette, + uint32_t* pPalette, const uint8_t* clip_scan) { int reset_r, reset_g, reset_b; int set_r, set_g, set_b; @@ -2483,7 +2483,7 @@ void _CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan, const uint8_t* src_scan, int src_left, int width, - FX_DWORD* pPalette, + uint32_t* pPalette, const uint8_t* clip_scan, uint8_t* dest_alpha_scan) { int reset_r, reset_g, reset_b; @@ -3959,7 +3959,7 @@ void _CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, } inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, int alpha_flag, - FX_DWORD mask_color, + uint32_t mask_color, int& mask_alpha, int& mask_red, int& mask_green, @@ -4026,8 +4026,8 @@ inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, } inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB_Format dest_format, - FX_DWORD*& pDestPalette, - FX_DWORD* pSrcPalette, + uint32_t*& pDestPalette, + uint32_t* pSrcPalette, void* icc_module, void* pIccTransform) { ICodec_IccModule* pIccModule = (ICodec_IccModule*)icc_module; @@ -4039,9 +4039,9 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); - pDestPalette = (FX_DWORD*)gray_pal; + pDestPalette = (uint32_t*)gray_pal; for (int i = 0; i < pal_count; i++) { - FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) + uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); pIccModule->TranslateScanline(pIccTransform, gray_pal, (const uint8_t*)&color, 1); @@ -4049,9 +4049,9 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, } } else { int palsize = 1 << (src_format & 0xff); - pDestPalette = FX_Alloc(FX_DWORD, palsize); + pDestPalette = FX_Alloc(uint32_t, palsize); for (int i = 0; i < palsize; i++) { - FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) + uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color, (const uint8_t*)&color, 1); @@ -4073,9 +4073,9 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, if ((dest_format & 0xff) == 8) { pIccModule->TranslateScanline(pIccTransform, gray_pal, gray_pal, pal_count); - pDestPalette = (FX_DWORD*)gray_pal; + pDestPalette = (uint32_t*)gray_pal; } else { - pDestPalette = FX_Alloc(FX_DWORD, pal_count); + pDestPalette = FX_Alloc(uint32_t, pal_count); for (int i = 0; i < pal_count; i++) { pIccModule->TranslateScanline( pIccTransform, (uint8_t*)&pDestPalette[i], &gray_pal[i], 1); @@ -4090,7 +4090,7 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); - pDestPalette = (FX_DWORD*)gray_pal; + pDestPalette = (uint32_t*)gray_pal; if (isSrcCmyk) { for (int i = 0; i < pal_count; i++) { FX_CMYK cmyk = pSrcPalette[i]; @@ -4109,9 +4109,9 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, } } else { int palsize = 1 << (src_format & 0xff); - pDestPalette = FX_Alloc(FX_DWORD, palsize); + pDestPalette = FX_Alloc(uint32_t, palsize); if (isDstCmyk == isSrcCmyk) { - FXSYS_memcpy(pDestPalette, pSrcPalette, palsize * sizeof(FX_DWORD)); + FXSYS_memcpy(pDestPalette, pSrcPalette, palsize * sizeof(uint32_t)); } else { for (int i = 0; i < palsize; i++) { FX_CMYK cmyk = pSrcPalette[i]; @@ -4135,10 +4135,10 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, gray_pal[i] = i; } } - pDestPalette = (FX_DWORD*)gray_pal; + pDestPalette = (uint32_t*)gray_pal; } else { int palsize = 1 << (src_format & 0xff); - pDestPalette = FX_Alloc(FX_DWORD, palsize); + pDestPalette = FX_Alloc(uint32_t, palsize); if (palsize == 2) { pDestPalette[0] = isSrcCmyk ? 255 : 0xff000000; pDestPalette[1] = isSrcCmyk ? 0 : 0xffffffff; @@ -4175,8 +4175,8 @@ CFX_ScanlineCompositor::~CFX_ScanlineCompositor() { FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, - FX_DWORD* pSrcPalette, - FX_DWORD mask_color, + uint32_t* pSrcPalette, + uint32_t mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder, @@ -4706,7 +4706,7 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, int width, int height, const CFX_DIBSource* pMask, - FX_DWORD color, + uint32_t color, int src_left, int src_top, int blend_type, @@ -4775,7 +4775,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { if (!m_pBuffer) { @@ -4791,7 +4791,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, return TRUE; } width = rect.Width(); - FX_DWORD dst_color; + uint32_t dst_color; if (alpha_flag >> 8) { dst_color = FXCMYK_TODIB(color); } else { @@ -4905,7 +4905,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, FXSYS_memset(dest_scan_alpha, 0xff, width); } if (Bpp == 4) { - FX_DWORD* scan = (FX_DWORD*)dest_scan; + uint32_t* scan = (uint32_t*)dest_scan; for (int col = 0; col < width; col++) { *scan++ = dst_color; } @@ -4996,7 +4996,7 @@ CFX_BitmapComposer::~CFX_BitmapComposer() { void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRgn, int bitmap_alpha, - FX_DWORD mask_color, + uint32_t mask_color, FX_RECT& dest_rect, FX_BOOL bVertical, FX_BOOL bFlipX, @@ -5028,7 +5028,7 @@ void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_format, - FX_DWORD* pSrcPalette) { + uint32_t* pSrcPalette) { m_SrcFormat = src_format; if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, m_MaskColor, FXDIB_BLEND_NORMAL, diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp index 9335800f9b..d9d5a3b0c0 100644 --- a/core/fxge/dib/fx_dib_convert.cpp +++ b/core/fxge/dib/fx_dib_convert.cpp @@ -14,20 +14,20 @@ class CFX_Palette { ~CFX_Palette(); FX_BOOL BuildPalette(const CFX_DIBSource* pBitmap); - FX_DWORD* GetPalette() const { return m_pPalette; } - FX_DWORD* GetColorLut() const { return m_cLut; } - FX_DWORD* GetAmountLut() const { return m_aLut; } + uint32_t* GetPalette() const { return m_pPalette; } + uint32_t* GetColorLut() const { return m_cLut; } + uint32_t* GetAmountLut() const { return m_aLut; } int32_t Getlut() const { return m_lut; } protected: - FX_DWORD* m_pPalette; - FX_DWORD* m_cLut; - FX_DWORD* m_aLut; + uint32_t* m_pPalette; + uint32_t* m_cLut; + uint32_t* m_aLut; int m_lut; }; -int _Partition(FX_DWORD* alut, FX_DWORD* clut, int l, int r) { - FX_DWORD p_a = alut[l]; - FX_DWORD p_c = clut[l]; +int _Partition(uint32_t* alut, uint32_t* clut, int l, int r) { + uint32_t p_a = alut[l]; + uint32_t p_c = clut[l]; while (l < r) { while (l < r && alut[r] >= p_a) { r--; @@ -48,34 +48,34 @@ int _Partition(FX_DWORD* alut, FX_DWORD* clut, int l, int r) { clut[l] = p_c; return l; } -void _Qsort(FX_DWORD* alut, FX_DWORD* clut, int l, int r) { +void _Qsort(uint32_t* alut, uint32_t* clut, int l, int r) { if (l < r) { int pI = _Partition(alut, clut, l, r); _Qsort(alut, clut, l, pI - 1); _Qsort(alut, clut, pI + 1, r); } } -void _ColorDecode(FX_DWORD pal_v, uint8_t& r, uint8_t& g, uint8_t& b) { +void _ColorDecode(uint32_t pal_v, uint8_t& r, uint8_t& g, uint8_t& b) { r = (uint8_t)((pal_v & 0xf00) >> 4); g = (uint8_t)(pal_v & 0x0f0); b = (uint8_t)((pal_v & 0x00f) << 4); } -void _Obtain_Pal(FX_DWORD* aLut, - FX_DWORD* cLut, - FX_DWORD* dest_pal, - FX_DWORD lut) { - FX_DWORD lut_1 = lut - 1; +void _Obtain_Pal(uint32_t* aLut, + uint32_t* cLut, + uint32_t* dest_pal, + uint32_t lut) { + uint32_t lut_1 = lut - 1; for (int row = 0; row < 256; row++) { int lut_offset = lut_1 - row; if (lut_offset < 0) { lut_offset += 256; } - FX_DWORD color = cLut[lut_offset]; + uint32_t color = cLut[lut_offset]; uint8_t r; uint8_t g; uint8_t b; _ColorDecode(color, r, g, b); - dest_pal[row] = ((FX_DWORD)r << 16) | ((FX_DWORD)g << 8) | b | 0xff000000; + dest_pal[row] = ((uint32_t)r << 16) | ((uint32_t)g << 8) | b | 0xff000000; aLut[lut_offset] = row; } } @@ -97,7 +97,7 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) { return FALSE; } FX_Free(m_pPalette); - m_pPalette = FX_Alloc(FX_DWORD, 256); + m_pPalette = FX_Alloc(uint32_t, 256); int bpp = pBitmap->GetBPP() / 8; int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); @@ -105,18 +105,18 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) { m_cLut = NULL; FX_Free(m_aLut); m_aLut = NULL; - m_cLut = FX_Alloc(FX_DWORD, 4096); - m_aLut = FX_Alloc(FX_DWORD, 4096); + m_cLut = FX_Alloc(uint32_t, 4096); + m_aLut = FX_Alloc(uint32_t, 4096); int row, col; m_lut = 0; for (row = 0; row < height; row++) { uint8_t* scan_line = (uint8_t*)pBitmap->GetScanline(row); for (col = 0; col < width; col++) { uint8_t* src_port = scan_line + col * bpp; - FX_DWORD b = src_port[0] & 0xf0; - FX_DWORD g = src_port[1] & 0xf0; - FX_DWORD r = src_port[2] & 0xf0; - FX_DWORD index = (r << 4) + g + (b >> 4); + uint32_t b = src_port[0] & 0xf0; + uint32_t g = src_port[1] & 0xf0; + uint32_t r = src_port[2] & 0xf0; + uint32_t index = (r << 4) + g + (b >> 4); m_aLut[index]++; } } @@ -176,10 +176,10 @@ FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int src_left, int src_top, void* pIccTransform) { - FX_DWORD* src_plt = pSrcBitmap->GetPalette(); + uint32_t* src_plt = pSrcBitmap->GetPalette(); uint8_t gray[2]; if (pIccTransform) { - FX_DWORD plt[2]; + uint32_t plt[2]; if (pSrcBitmap->IsCmykImage()) { plt[0] = FXCMYK_TODIB(src_plt[0]); plt[1] = FXCMYK_TODIB(src_plt[1]); @@ -238,10 +238,10 @@ FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int src_left, int src_top, void* pIccTransform) { - FX_DWORD* src_plt = pSrcBitmap->GetPalette(); + uint32_t* src_plt = pSrcBitmap->GetPalette(); uint8_t gray[256]; if (pIccTransform) { - FX_DWORD plt[256]; + uint32_t plt[256]; if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < 256; i++) { plt[i] = FXCMYK_TODIB(src_plt[i]); @@ -323,10 +323,10 @@ FX_BOOL ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, 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]), r, g, b); + AdobeCMYK_to_sRGB1(FXSYS_GetCValue((uint32_t)src_scan[0]), + FXSYS_GetMValue((uint32_t)src_scan[1]), + FXSYS_GetYValue((uint32_t)src_scan[2]), + FXSYS_GetKValue((uint32_t)src_scan[3]), r, g, b); *dest_scan++ = FXRGB2GRAY(r, g, b); src_scan += 4; } @@ -380,14 +380,14 @@ FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, - FX_DWORD* dst_plt, + uint32_t* dst_plt, void* pIccTransform) { ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); - FX_DWORD* src_plt = pSrcBitmap->GetPalette(); + uint32_t* src_plt = pSrcBitmap->GetPalette(); int plt_size = pSrcBitmap->GetPaletteSize(); if (pIccTransform) { - FX_DWORD plt[256]; + uint32_t plt[256]; uint8_t* bgr_ptr = (uint8_t*)plt; if (pSrcBitmap->IsCmykImage()) { for (int i = 0; i < plt_size; i++) { @@ -431,18 +431,18 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, - FX_DWORD* dst_plt) { + uint32_t* dst_plt) { int bpp = pSrcBitmap->GetBPP() / 8; int row, col; CFX_Palette palette; palette.BuildPalette(pSrcBitmap); - FX_DWORD* cLut = palette.GetColorLut(); - FX_DWORD* aLut = palette.GetAmountLut(); + uint32_t* cLut = palette.GetColorLut(); + uint32_t* aLut = palette.GetAmountLut(); if (!cLut || !aLut) { return FALSE; } int lut = palette.Getlut(); - FX_DWORD* pPalette = palette.GetPalette(); + uint32_t* pPalette = palette.GetPalette(); if (lut > 256) { int err, min_err; int lut_256 = lut - 256; @@ -452,7 +452,7 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, _ColorDecode(cLut[row], r, g, b); int clrindex = 0; for (int col = 0; col < 256; col++) { - FX_DWORD p_color = *(pPalette + col); + uint32_t p_color = *(pPalette + col); int d_r = r - (uint8_t)(p_color >> 16); int d_g = g - (uint8_t)(p_color >> 8); int d_b = b - (uint8_t)(p_color); @@ -475,7 +475,7 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, int r = src_port[2] & 0xf0; int g = src_port[1] & 0xf0; int b = src_port[0] & 0xf0; - FX_DWORD clrindex = (r << 4) + g + (b >> 4); + uint32_t clrindex = (r << 4) + g + (b >> 4); for (int i = lut_1; i >= 0; i--) if (clrindex == cLut[i]) { *(dest_scan + col) = (uint8_t)(aLut[i]); @@ -483,7 +483,7 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf, } } } - FXSYS_memcpy(dst_plt, pPalette, sizeof(FX_DWORD) * 256); + FXSYS_memcpy(dst_plt, pPalette, sizeof(uint32_t) * 256); return TRUE; } FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, @@ -493,7 +493,7 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, - FX_DWORD* dst_plt, + uint32_t* dst_plt, void* pIccTransform) { FX_BOOL ret = ConvertBuffer_Rgb2PltRgb8_NoTransform( dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, @@ -574,8 +574,8 @@ FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; - FX_DWORD* src_plt = pSrcBitmap->GetPalette(); - FX_DWORD plt[2]; + uint32_t* src_plt = pSrcBitmap->GetPalette(); + uint32_t plt[2]; uint8_t* bgr_ptr = (uint8_t*)plt; if (pSrcBitmap->IsCmykImage()) { plt[0] = FXCMYK_TODIB(src_plt[0]); @@ -633,8 +633,8 @@ FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, int src_top, void* pIccTransform) { int comps = (dst_format & 0xff) / 8; - FX_DWORD* src_plt = pSrcBitmap->GetPalette(); - FX_DWORD plt[256]; + uint32_t* src_plt = pSrcBitmap->GetPalette(); + uint32_t plt[256]; uint8_t* bgr_ptr = (uint8_t*)plt; if (!pSrcBitmap->IsCmykImage()) { for (int i = 0; i < 256; i++) { @@ -817,7 +817,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, - FX_DWORD*& d_pal, + uint32_t*& d_pal, void* pIccTransform) { FXDIB_Format src_format = pSrcBitmap->GetFormat(); if (!CFX_GEModule::Get()->GetCodecModule() || @@ -864,7 +864,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); } - d_pal = FX_Alloc(FX_DWORD, 256); + d_pal = FX_Alloc(uint32_t, 256); if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pSrcBitmap->GetPalette()) { return ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height, @@ -997,7 +997,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, delete pClone; return NULL; } - FX_DWORD* pal_8bpp = NULL; + uint32_t* pal_8bpp = NULL; ret = ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(), m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform); if (!ret) { @@ -1075,7 +1075,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format, } } FX_BOOL ret = FALSE; - FX_DWORD* pal_8bpp = NULL; + uint32_t* pal_8bpp = NULL; ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height, this, 0, 0, pal_8bpp, pIccTransform); if (!ret) { diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index 10e5e67bbc..a68583b346 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -231,7 +231,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, m_pExtraAlphaBuf = NULL; m_pDestMaskScanline = NULL; m_DestClip = clip_rect; - FX_DWORD size = clip_rect.Width(); + uint32_t size = clip_rect.Width(); if (size && m_DestBpp > (int)(INT_MAX / size)) { return; } @@ -351,7 +351,7 @@ FX_BOOL CStretchEngine::StartStretchHorz() { if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) { m_pExtraAlphaBuf = FX_Alloc2D(unsigned char, m_SrcClip.Height(), m_ExtraMaskPitch); - FX_DWORD size = (m_DestClip.Width() * 8 + 31) / 32 * 4; + uint32_t size = (m_DestClip.Width() * 8 + 31) / 32 * 4; m_pDestMaskScanline = FX_TryAlloc(unsigned char, size); if (!m_pDestMaskScanline) { return FALSE; @@ -730,9 +730,9 @@ void CStretchEngine::StretchVert() { dest_a = dest_a < 0 ? 0 : dest_a > 16711680 ? 16711680 : dest_a; } if (dest_a) { - int r = ((FX_DWORD)dest_r_y) * 255 / dest_a; - int g = ((FX_DWORD)dest_g_m) * 255 / dest_a; - int b = ((FX_DWORD)dest_b_c) * 255 / dest_a; + int r = ((uint32_t)dest_r_y) * 255 / dest_a; + int g = ((uint32_t)dest_g_m) * 255 / dest_a; + int b = ((uint32_t)dest_b_c) * 255 / dest_a; dest_scan[0] = b > 255 ? 255 : b < 0 ? 0 : b; dest_scan[1] = g > 255 ? 255 : g < 0 ? 0 : g; dest_scan[2] = r > 255 ? 255 : r < 0 ? 0 : r; @@ -782,7 +782,7 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest, int dest_width, int dest_height, const FX_RECT& rect, - FX_DWORD flags) { + uint32_t flags) { m_DestFormat = _GetStretchedFormat(pSource); m_DestBPP = m_DestFormat & 0xff; m_pDest = pDest; @@ -863,7 +863,7 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() { m_DestHeight = -m_DestHeight; } m_LineIndex = 0; - FX_DWORD size = m_ClipRect.Width(); + uint32_t size = m_ClipRect.Width(); if (size && m_DestBPP > (int)(INT_MAX / size)) { return FALSE; } diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index a7f7dc75bc..3772459eca 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -20,25 +20,25 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, const CFX_DIBSource* pSrcBitmap, int src_left, int src_top, - FX_DWORD*& pal, + uint32_t*& pal, void* pIccTransform); -void CmykDecode(FX_DWORD cmyk, int& c, int& m, int& y, int& k) { +void CmykDecode(uint32_t cmyk, int& c, int& m, int& y, int& k) { c = FXSYS_GetCValue(cmyk); m = FXSYS_GetMValue(cmyk); y = FXSYS_GetYValue(cmyk); k = FXSYS_GetKValue(cmyk); } -void ArgbDecode(FX_DWORD argb, int& a, int& r, int& g, int& b) { +void ArgbDecode(uint32_t argb, int& a, int& r, int& g, int& b) { a = FXARGB_A(argb); r = FXARGB_R(argb); g = FXARGB_G(argb); b = FXARGB_B(argb); } -void ArgbDecode(FX_DWORD argb, int& a, FX_COLORREF& rgb) { +void ArgbDecode(uint32_t argb, int& a, FX_COLORREF& rgb) { a = FXARGB_A(argb); rgb = FXSYS_RGB(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb)); } -FX_DWORD ArgbEncode(int a, FX_COLORREF rgb) { +uint32_t ArgbEncode(int a, FX_COLORREF rgb) { return FXARGB_MAKE(a, FXSYS_GetRValue(rgb), FXSYS_GetGValue(rgb), FXSYS_GetBValue(rgb)); } @@ -196,8 +196,8 @@ CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const { int right_shift = 32 - left_shift; int dword_count = pNewBitmap->m_Pitch / 4; for (int row = rect.top; row < rect.bottom; row++) { - FX_DWORD* src_scan = (FX_DWORD*)GetScanline(row) + rect.left / 32; - FX_DWORD* dest_scan = (FX_DWORD*)pNewBitmap->GetScanline(row - rect.top); + uint32_t* src_scan = (uint32_t*)GetScanline(row) + rect.left / 32; + uint32_t* dest_scan = (uint32_t*)pNewBitmap->GetScanline(row - rect.top); for (int i = 0; i < dword_count; i++) { dest_scan[i] = (src_scan[i] << left_shift) | (src_scan[i + 1] >> right_shift); @@ -205,7 +205,7 @@ CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const { } } else { int copy_len = (pNewBitmap->GetWidth() * pNewBitmap->GetBPP() + 7) / 8; - if (m_Pitch < (FX_DWORD)copy_len) { + if (m_Pitch < (uint32_t)copy_len) { copy_len = m_Pitch; } for (int row = rect.top; row < rect.bottom; row++) { @@ -221,7 +221,7 @@ void CFX_DIBSource::BuildPalette() { return; } if (GetBPP() == 1) { - m_pPalette = FX_Alloc(FX_DWORD, 2); + m_pPalette = FX_Alloc(uint32_t, 2); if (IsCmykImage()) { m_pPalette[0] = 0xff; m_pPalette[1] = 0; @@ -230,7 +230,7 @@ void CFX_DIBSource::BuildPalette() { m_pPalette[1] = 0xffffffff; } } else if (GetBPP() == 8) { - m_pPalette = FX_Alloc(FX_DWORD, 256); + m_pPalette = FX_Alloc(uint32_t, 256); if (IsCmykImage()) { for (int i = 0; i < 256; i++) { m_pPalette[i] = 0xff - i; @@ -256,7 +256,7 @@ FX_BOOL CFX_DIBSource::BuildAlphaMask() { m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch()); return TRUE; } -FX_DWORD CFX_DIBSource::GetPaletteEntry(int index) const { +uint32_t CFX_DIBSource::GetPaletteEntry(int index) const { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (m_pPalette) { return m_pPalette[index]; @@ -272,14 +272,14 @@ FX_DWORD CFX_DIBSource::GetPaletteEntry(int index) const { } return index * 0x10101 | 0xff000000; } -void CFX_DIBSource::SetPaletteEntry(int index, FX_DWORD color) { +void CFX_DIBSource::SetPaletteEntry(int index, uint32_t color) { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (!m_pPalette) { BuildPalette(); } m_pPalette[index] = color; } -int CFX_DIBSource::FindPalette(FX_DWORD color) const { +int CFX_DIBSource::FindPalette(uint32_t color) const { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (!m_pPalette) { if (IsCmykImage()) { @@ -300,7 +300,7 @@ int CFX_DIBSource::FindPalette(FX_DWORD color) const { } return -1; } -void CFX_DIBitmap::Clear(FX_DWORD color) { +void CFX_DIBitmap::Clear(uint32_t color) { if (!m_pBuffer) { return; } @@ -345,7 +345,7 @@ void CFX_DIBitmap::Clear(FX_DWORD color) { case FXDIB_Argb: { color = IsCmykImage() ? FXCMYK_TODIB(color) : FXARGB_TODIB(color); for (int i = 0; i < m_Width; i++) { - ((FX_DWORD*)m_pBuffer)[i] = color; + ((uint32_t*)m_pBuffer)[i] = color; } for (int row = 1; row < m_Height; row++) { FXSYS_memcpy(m_pBuffer + row * m_Pitch, m_pBuffer, m_Pitch); @@ -446,7 +446,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, } uint8_t* dest_buf = m_pBuffer + dest_top * m_Pitch + dest_left * GetBPP() / 8; - FX_DWORD* d_plt = NULL; + uint32_t* d_plt = NULL; if (!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height, pSrcBitmap, src_left, src_top, d_plt, pIccTransform)) { return FALSE; @@ -459,7 +459,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int width, int height, const CFX_DIBSource* pMask, - FX_DWORD color, + uint32_t color, int src_left, int src_top, int alpha_flag, @@ -479,7 +479,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, } int src_bpp = pMask->GetBPP(); int alpha; - FX_DWORD dst_color; + uint32_t dst_color; if (alpha_flag >> 8) { alpha = alpha_flag & 0xff; dst_color = FXCMYK_TODIB(color); @@ -507,8 +507,8 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, } 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); + uint32_t* dest_pos = + (uint32_t*)(m_pBuffer + (dest_top + row) * m_Pitch + dest_left * 4); const uint8_t* src_scan = pMask->GetScanline(src_top + row); if (src_bpp == 1) { for (int col = 0; col < width; col++) { @@ -563,22 +563,22 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, } return TRUE; } -void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) { +void CFX_DIBSource::CopyPalette(const uint32_t* pSrc, uint32_t size) { if (!pSrc || GetBPP() > 8) { FX_Free(m_pPalette); m_pPalette = NULL; } else { - FX_DWORD pal_size = 1 << GetBPP(); + uint32_t pal_size = 1 << GetBPP(); if (!m_pPalette) { - m_pPalette = FX_Alloc(FX_DWORD, pal_size); + m_pPalette = FX_Alloc(uint32_t, pal_size); } if (pal_size > size) { pal_size = size; } - FXSYS_memcpy(m_pPalette, pSrc, pal_size * sizeof(FX_DWORD)); + FXSYS_memcpy(m_pPalette, pSrc, pal_size * sizeof(uint32_t)); } } -void CFX_DIBSource::GetPalette(FX_DWORD* pal, int alpha) const { +void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const { ASSERT(GetBPP() <= 8 && !IsCmykImage()); if (GetBPP() == 1) { pal[0] = @@ -1068,7 +1068,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) { } return TRUE; } -FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const { +uint32_t CFX_DIBitmap::GetPixel(int x, int y) const { if (!m_pBuffer) { return 0; } @@ -1101,7 +1101,7 @@ FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const { } return 0; } -void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) { +void CFX_DIBitmap::SetPixel(int x, int y, uint32_t color) { if (!m_pBuffer) { return; } @@ -1184,8 +1184,8 @@ void CFX_DIBitmap::DownSampleScanline(int line, 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; - FX_DWORD src_x = dest_x * m_Width / dest_width; + uint32_t dest_x = clip_left + i; + uint32_t src_x = dest_x * m_Width / dest_width; if (bFlipX) { src_x = m_Width - src_x - 1; } @@ -1194,8 +1194,8 @@ void CFX_DIBitmap::DownSampleScanline(int line, } } else if (src_Bpp == 1) { for (int i = 0; i < clip_width; i++) { - FX_DWORD dest_x = clip_left + i; - FX_DWORD src_x = dest_x * m_Width / dest_width; + uint32_t dest_x = clip_left + i; + uint32_t src_x = dest_x * m_Width / dest_width; if (bFlipX) { src_x = m_Width - src_x - 1; } @@ -1222,8 +1222,8 @@ void CFX_DIBitmap::DownSampleScanline(int line, } } else { for (int i = 0; i < clip_width; i++) { - FX_DWORD dest_x = clip_left + i; - FX_DWORD src_x = + uint32_t dest_x = clip_left + i; + uint32_t src_x = bFlipX ? (m_Width - dest_x * m_Width / dest_width - 1) * src_Bpp : (dest_x * m_Width / dest_width) * src_Bpp; src_x %= m_Width * src_Bpp; @@ -1237,8 +1237,8 @@ void CFX_DIBitmap::DownSampleScanline(int line, // TODO(weili): Split this function into two for handling CMYK and RGB // colors separately. -FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, - FX_DWORD backcolor) { +FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, + uint32_t backcolor) { ASSERT(!IsAlphaMask()); if (!m_pBuffer || IsAlphaMask()) { return FALSE; @@ -1371,7 +1371,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor, } return TRUE; } -FX_BOOL CFX_DIBitmap::DitherFS(const FX_DWORD* pPalette, +FX_BOOL CFX_DIBitmap::DitherFS(const uint32_t* pPalette, int pal_size, const FX_RECT* pRect) { if (!m_pBuffer) { @@ -1498,7 +1498,7 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const { } else { ASSERT(Bpp == 4); for (int col = 0; col < m_Width; col++) { - *(FX_DWORD*)dest_scan = *(FX_DWORD*)src_scan; + *(uint32_t*)dest_scan = *(uint32_t*)src_scan; dest_scan -= 4; src_scan += 4; } @@ -1507,7 +1507,7 @@ CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const { } if (m_pAlphaMask) { pDestBuffer = pFlipped->m_pAlphaMask->GetBuffer(); - FX_DWORD dest_pitch = pFlipped->m_pAlphaMask->GetPitch(); + uint32_t dest_pitch = pFlipped->m_pAlphaMask->GetPitch(); for (int row = 0; row < m_Height; row++) { const uint8_t* src_scan = m_pAlphaMask->GetScanline(row); uint8_t* dest_scan = @@ -1595,9 +1595,9 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn* pClipRgn, const CFX_DIBSource* pSource, int bitmap_alpha, - FX_DWORD mask_color, + uint32_t mask_color, const CFX_Matrix* pMatrix, - FX_DWORD dib_flags, + uint32_t dib_flags, FX_BOOL bRgbByteOrder, int alpha_flag, void* pIccTransform, @@ -1748,7 +1748,7 @@ void CFX_BitmapStorer::ComposeScanline(int line, FX_BOOL CFX_BitmapStorer::SetInfo(int width, int height, FXDIB_Format src_format, - FX_DWORD* pSrcPalette) { + uint32_t* pSrcPalette) { m_pBitmap = new CFX_DIBitmap; if (!m_pBitmap->Create(width, height, src_format)) { delete m_pBitmap; diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index dc6fb93c75..91c65fbbc8 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -229,9 +229,9 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, dest_scan += (result_height - 1) * dest_pitch; } if (nBytes == 4) { - FX_DWORD* src_scan = (FX_DWORD*)GetScanline(row) + col_start; + uint32_t* src_scan = (uint32_t*)GetScanline(row) + col_start; for (int col = col_start; col < col_end; col++) { - *(FX_DWORD*)dest_scan = *src_scan++; + *(uint32_t*)dest_scan = *src_scan++; dest_scan += dest_step; } } else { @@ -299,7 +299,7 @@ FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, CFX_DIBitmap* CFX_DIBSource::TransformTo(const CFX_Matrix* pDestMatrix, int& result_left, int& result_top, - FX_DWORD flags, + uint32_t flags, const FX_RECT* pDestClip) const { CFX_ImageTransformer transformer; transformer.Start(this, pDestMatrix, flags, pDestClip); @@ -311,7 +311,7 @@ CFX_DIBitmap* CFX_DIBSource::TransformTo(const CFX_Matrix* pDestMatrix, } CFX_DIBitmap* CFX_DIBSource::StretchTo(int dest_width, int dest_height, - FX_DWORD flags, + uint32_t flags, const FX_RECT* pClip) const { FX_RECT clip_rect(0, 0, FXSYS_abs(dest_width), FXSYS_abs(dest_height)); if (pClip) { @@ -623,7 +623,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { int Bpp = m_Storer.GetBitmap()->GetBPP() / 8; int destBpp = pTransformed->GetBPP() / 8; if (Bpp == 1) { - FX_DWORD argb[256]; + uint32_t argb[256]; FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette(); if (pPal) { for (int i = 0; i < 256; i++) { @@ -667,7 +667,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { } int row_offset_l = src_row_l * stretch_pitch; int row_offset_r = src_row_r * stretch_pitch; - FX_DWORD r_bgra_cmyk = argb[bilinear_interpol( + uint32_t r_bgra_cmyk = argb[bilinear_interpol( stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0)]; if (transformF == FXDIB_Rgba) { @@ -675,7 +675,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { - *(FX_DWORD*)dest_pos = r_bgra_cmyk; + *(uint32_t*)dest_pos = r_bgra_cmyk; } } dest_pos += destBpp; @@ -702,7 +702,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, res_x, res_y, stretch_width, stretch_height); - FX_DWORD r_bgra_cmyk = + uint32_t r_bgra_cmyk = argb[bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, 1, 0)]; if (transformF == FXDIB_Rgba) { @@ -710,7 +710,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { - *(FX_DWORD*)dest_pos = r_bgra_cmyk; + *(uint32_t*)dest_pos = r_bgra_cmyk; } } dest_pos += destBpp; @@ -731,14 +731,14 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { if (src_row == stretch_height) { src_row--; } - FX_DWORD r_bgra_cmyk = + uint32_t r_bgra_cmyk = argb[stretch_buf[src_row * stretch_pitch + src_col]]; if (transformF == FXDIB_Rgba) { dest_pos[0] = (uint8_t)(r_bgra_cmyk >> 24); dest_pos[1] = (uint8_t)(r_bgra_cmyk >> 16); dest_pos[2] = (uint8_t)(r_bgra_cmyk >> 8); } else { - *(FX_DWORD*)dest_pos = r_bgra_cmyk; + *(uint32_t*)dest_pos = r_bgra_cmyk; } } dest_pos += destBpp; @@ -794,7 +794,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { r_pos_k_r = bilinear_interpol( stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 3); - *(FX_DWORD*)dest_pos = + *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } @@ -802,7 +802,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { uint8_t r_pos_a_r = bilinear_interpol( stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 3); - *(FX_DWORD*)dest_pos = FXARGB_TODIB( + *(uint32_t*)dest_pos = FXARGB_TODIB( FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } @@ -812,11 +812,11 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { r_pos_k_r = bilinear_interpol( stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, Bpp, 3); - *(FX_DWORD*)dest_pos = + *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } else { - *(FX_DWORD*)dest_pos = FXARGB_TODIB( + *(uint32_t*)dest_pos = FXARGB_TODIB( FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } @@ -865,7 +865,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { r_pos_k_r = bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 3); - *(FX_DWORD*)dest_pos = + *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } @@ -873,7 +873,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { uint8_t r_pos_a_r = bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 3); - *(FX_DWORD*)dest_pos = FXARGB_TODIB( + *(uint32_t*)dest_pos = FXARGB_TODIB( FXARGB_MAKE(r_pos_a_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } @@ -883,11 +883,11 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { r_pos_k_r = bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, Bpp, 3); - *(FX_DWORD*)dest_pos = + *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode(r_pos_blue_c_r, r_pos_green_m_r, r_pos_red_y_r, r_pos_k_r)); } else { - *(FX_DWORD*)dest_pos = FXARGB_TODIB( + *(uint32_t*)dest_pos = FXARGB_TODIB( FXARGB_MAKE(r_pos_k_r, r_pos_red_y_r, r_pos_green_m_r, r_pos_blue_c_r)); } @@ -920,19 +920,19 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { dest_pos[1] = src_pos[1]; dest_pos[2] = src_pos[2]; } else { - *(FX_DWORD*)dest_pos = FXCMYK_TODIB(CmykEncode( + *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode( src_pos[0], src_pos[1], src_pos[2], src_pos[3])); } } else { - *(FX_DWORD*)dest_pos = FXARGB_TODIB(FXARGB_MAKE( + *(uint32_t*)dest_pos = FXARGB_TODIB(FXARGB_MAKE( src_pos[3], src_pos[2], src_pos[1], src_pos[0])); } } else { if (transformF == FXDIB_Cmyka) { - *(FX_DWORD*)dest_pos = FXCMYK_TODIB(CmykEncode( + *(uint32_t*)dest_pos = FXCMYK_TODIB(CmykEncode( src_pos[0], src_pos[1], src_pos[2], src_pos[3])); } else { - *(FX_DWORD*)dest_pos = FXARGB_TODIB( + *(uint32_t*)dest_pos = FXARGB_TODIB( FXARGB_MAKE(0xff, src_pos[2], src_pos[1], src_pos[0])); } } diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp index eefac5c033..d791859b03 100644 --- a/core/fxge/ge/fx_ge_device.cpp +++ b/core/fxge/ge/fx_ge_device.cpp @@ -113,8 +113,8 @@ void CFX_RenderDevice::UpdateClipBox() { FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, @@ -201,7 +201,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData, m_pDeviceDriver->GetDriverType())) { CFX_GraphStateData graphState; graphState.m_LineWidth = 0.0f; - FX_DWORD strokecolor = fill_color; + uint32_t strokecolor = fill_color; if (bThin) { if (FXGETFLAG_COLORTYPE(alpha_flag)) { FXSETFLAG_ALPHA_STROKE(alpha_flag, fill_alpha >> 2); @@ -244,8 +244,8 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath( const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, @@ -302,7 +302,7 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath( FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { if (m_pDeviceDriver->SetPixel(x, y, color, alpha_flag, pIccTransform)) { @@ -312,7 +312,7 @@ FX_BOOL CFX_RenderDevice::SetPixel(int x, return FillRect(&rect, color, alpha_flag, pIccTransform); } FX_BOOL CFX_RenderDevice::FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag, void* pIccTransform, int blend_type) { @@ -343,7 +343,7 @@ FX_BOOL CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int fill_mode, int alpha_flag, void* pIccTransform, @@ -436,7 +436,7 @@ FX_BOOL CFX_RenderDevice::StretchDIBits(const CFX_DIBSource* pBitmap, int top, int dest_width, int dest_height, - FX_DWORD flags, + uint32_t flags, void* pIccTransform, int blend_mode) { FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); @@ -452,7 +452,7 @@ FX_BOOL CFX_RenderDevice::StretchDIBits(const CFX_DIBSource* pBitmap, FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap, int left, int top, - FX_DWORD argb, + uint32_t argb, int alpha_flag, void* pIccTransform) { FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); @@ -465,8 +465,8 @@ FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, int top, int dest_width, int dest_height, - FX_DWORD argb, - FX_DWORD flags, + uint32_t argb, + uint32_t flags, int alpha_flag, void* pIccTransform) { FX_RECT dest_rect(left, top, left + dest_width, top + dest_height); @@ -478,9 +478,9 @@ FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap, } FX_BOOL CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD argb, + uint32_t argb, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, void*& handle, int alpha_flag, void* pIccTransform, diff --git a/core/fxge/ge/fx_ge_font.cpp b/core/fxge/ge/fx_ge_font.cpp index b2c92f516d..04019a059c 100644 --- a/core/fxge/ge/fx_ge_font.cpp +++ b/core/fxge/ge/fx_ge_font.cpp @@ -13,7 +13,7 @@ namespace { #ifdef PDF_ENABLE_XFA -const FX_DWORD g_EncodingID[] = { +const uint32_t g_EncodingID[] = { FXFM_ENCODING_MS_SYMBOL, FXFM_ENCODING_UNICODE, FXFM_ENCODING_MS_SJIS, FXFM_ENCODING_MS_GB2312, FXFM_ENCODING_MS_BIG5, FXFM_ENCODING_MS_WANSUNG, @@ -24,7 +24,7 @@ const FX_DWORD g_EncodingID[] = { }; CFX_UnicodeEncodingEx* _FXFM_CreateFontEncoding(CFX_Font* pFont, - FX_DWORD nEncodingID) { + uint32_t nEncodingID) { if (FXFT_Select_Charmap(pFont->GetFace(), nEncodingID)) return nullptr; return new CFX_UnicodeEncodingEx(pFont, nEncodingID); @@ -127,7 +127,7 @@ void CFX_Font::DeleteFace() { } void CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, - FX_DWORD flags, + uint32_t flags, int weight, int italic_angle, int CharsetCP, @@ -213,7 +213,7 @@ FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile, } #endif // PDF_ENABLE_XFA -int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) { +int CFX_Font::GetGlyphWidth(uint32_t glyph_index) { if (!m_Face) { return 0; } @@ -231,7 +231,7 @@ int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) { return width; } -FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD size) { +FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, uint32_t size) { m_pFontDataAllocation = FX_Alloc(uint8_t, size); FXSYS_memcpy(m_pFontDataAllocation, data, size); m_Face = FT_LoadFont(m_pFontDataAllocation, size); @@ -261,7 +261,7 @@ int CFX_Font::GetDescent() const { FXFT_Get_Face_Descender(m_Face)); } -FX_BOOL CFX_Font::GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox) { +FX_BOOL CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) { if (!m_Face) return FALSE; @@ -448,7 +448,7 @@ CFX_UnicodeEncoding::CFX_UnicodeEncoding(CFX_Font* pFont) : m_pFont(pFont) {} CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {} -FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) { +uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) { FXFT_Face face = m_pFont->GetFace(); if (!face) return charcode; @@ -457,7 +457,7 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) { return FXFT_Get_Char_Index(face, charcode); if (m_pFont->GetSubstFont() && m_pFont->GetSubstFont()->m_Charset == 2) { - FX_DWORD index = 0; + uint32_t index = 0; if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0) index = FXFT_Get_Char_Index(face, charcode); if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN)) @@ -468,12 +468,12 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) { #ifdef PDF_ENABLE_XFA CFX_UnicodeEncodingEx::CFX_UnicodeEncodingEx(CFX_Font* pFont, - FX_DWORD EncodingID) + uint32_t EncodingID) : CFX_UnicodeEncoding(pFont), m_nEncodingID(EncodingID) {} CFX_UnicodeEncodingEx::~CFX_UnicodeEncodingEx() {} -FX_DWORD CFX_UnicodeEncodingEx::GlyphFromCharCode(FX_DWORD charcode) { +uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) { FXFT_Face face = m_pFont->GetFace(); FT_UInt nIndex = FXFT_Get_Char_Index(face, charcode); if (nIndex > 0) { @@ -482,7 +482,7 @@ FX_DWORD CFX_UnicodeEncodingEx::GlyphFromCharCode(FX_DWORD charcode) { int nmaps = FXFT_Get_Face_CharmapCount(face); int m = 0; while (m < nmaps) { - FX_DWORD nEncodingID = + uint32_t nEncodingID = FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[m++]); if (m_nEncodingID == nEncodingID) { continue; @@ -501,7 +501,7 @@ FX_DWORD CFX_UnicodeEncodingEx::GlyphFromCharCode(FX_DWORD charcode) { return 0; } -FX_DWORD CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const { +uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const { if (m_nEncodingID == FXFM_ENCODING_UNICODE || m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) { return Unicode; @@ -516,11 +516,11 @@ FX_DWORD CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const { return Unicode; } } - return static_cast<FX_DWORD>(-1); + return static_cast<uint32_t>(-1); } CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont, - FX_DWORD nEncodingID) { + uint32_t nEncodingID) { if (!pFont || !pFont->GetFace()) return nullptr; diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp index 27b82f5803..709ef0031b 100644 --- a/core/fxge/ge/fx_ge_fontmap.cpp +++ b/core/fxge/ge/fx_ge_fontmap.cpp @@ -16,7 +16,7 @@ #define GET_TT_SHORT(w) (uint16_t)(((w)[0] << 8) | (w)[1]) #define GET_TT_LONG(w) \ - (FX_DWORD)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) + (uint32_t)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) #define FX_FONT_STYLE_None 0x00 #define FX_FONT_STYLE_Bold 0x01 @@ -27,7 +27,7 @@ namespace { struct BuiltinFont { const uint8_t* m_pFontData; - FX_DWORD m_dwSize; + uint32_t m_dwSize; }; const BuiltinFont g_FoxitFonts[14] = { @@ -211,8 +211,8 @@ const struct CODEPAGE_MAP { {10081, 86}, }; -const FX_DWORD kTableNAME = FXDWORD_GET_MSBFIRST("name"); -const FX_DWORD kTableTTCF = FXDWORD_GET_MSBFIRST("ttcf"); +const uint32_t kTableNAME = FXDWORD_GET_MSBFIRST("name"); +const uint32_t kTableTTCF = FXDWORD_GET_MSBFIRST("ttcf"); int CompareFontFamilyString(const void* key, const void* element) { CFX_ByteString str_key((const FX_CHAR*)key); @@ -237,7 +237,7 @@ CFX_ByteString KeyNameFromFace(const CFX_ByteString& face_name, return key; } -CFX_ByteString KeyNameFromSize(int ttc_size, FX_DWORD checksum) { +CFX_ByteString KeyNameFromSize(int ttc_size, uint32_t checksum) { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); return key; @@ -256,7 +256,7 @@ CFX_ByteString TT_NormalizeName(const FX_CHAR* family) { return norm; } -CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, FX_DWORD size) { +CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, uint32_t size) { CFX_ByteString buffer; if (!FXSYS_fread(buffer.GetBuffer(size), size, 1, pFile)) { return CFX_ByteString(); @@ -267,13 +267,13 @@ CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, FX_DWORD size) { 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++) { + uint32_t nTables, + uint32_t tag) { + for (uint32_t i = 0; i < nTables; i++) { 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); + uint32_t offset = GET_TT_LONG(p + 8); + uint32_t size = GET_TT_LONG(p + 12); FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); return FPDF_ReadStringFromFile(pFile, size); } @@ -362,7 +362,7 @@ FX_BOOL CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) { return FALSE; } -FX_DWORD GetCharset(int charset) { +uint32_t GetCharset(int charset) { switch (charset) { case FXFONT_SHIFTJIS_CHARSET: return CHARSET_FLAG_SHIFTJIS; @@ -385,7 +385,7 @@ FX_DWORD GetCharset(int charset) { int32_t GetSimilarValue(int weight, FX_BOOL bItalic, int pitch_family, - FX_DWORD style) { + uint32_t style) { int32_t iSimilarValue = 0; if (!!(style & FXFONT_BOLD) == (weight > 400)) { iSimilarValue += 16; @@ -480,7 +480,7 @@ void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, - FX_DWORD flags, + uint32_t flags, int weight, int italic_angle, int CharsetCP, @@ -507,7 +507,7 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, int weight, FX_BOOL bItalic, uint8_t* pData, - FX_DWORD size, + uint32_t size, int face_index) { CTTFontDesc* pFontDesc = new CTTFontDesc; pFontDesc->m_Type = 1; @@ -535,12 +535,12 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, } int GetTTCIndex(const uint8_t* pFontData, - FX_DWORD ttc_size, - FX_DWORD font_offset) { + uint32_t ttc_size, + uint32_t font_offset) { int face_index = 0; const uint8_t* p = pFontData + 8; - FX_DWORD nfont = GET_TT_LONG(p); - FX_DWORD index; + uint32_t nfont = GET_TT_LONG(p); + uint32_t index; for (index = 0; index < nfont; index++) { p = pFontData + 12 + index * 4; if (GET_TT_LONG(p) == font_offset) { @@ -555,7 +555,7 @@ int GetTTCIndex(const uint8_t* pFontData, return face_index; } FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, - FX_DWORD checksum, + uint32_t checksum, int font_offset, uint8_t*& pFontData) { auto it = m_FaceMap.find(KeyNameFromSize(ttc_size, checksum)); @@ -573,9 +573,9 @@ FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, return pFontDesc->m_TTCFace.m_pFaces[face_index]; } FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, - FX_DWORD checksum, + uint32_t checksum, uint8_t* pData, - FX_DWORD size, + uint32_t size, int font_offset) { CTTFontDesc* pFontDesc = new CTTFontDesc; pFontDesc->m_Type = 2; @@ -592,7 +592,7 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, } FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, - FX_DWORD size, + uint32_t size, int face_index) { InitFTLibrary(); FXFT_Library library = m_FTLibrary; @@ -633,7 +633,7 @@ void CFX_FontMgr::ReleaseFace(FXFT_Face face) { bool CFX_FontMgr::GetBuiltinFont(size_t index, const uint8_t** pFontData, - FX_DWORD* size) { + uint32_t* size) { if (index < FX_ArraySize(g_FoxitFonts)) { *pFontData = g_FoxitFonts[index].m_pFontData; *size = g_FoxitFonts[index].m_dwSize; @@ -682,7 +682,7 @@ void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { m_pFontInfo = pFontInfo; } static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr, - FX_DWORD string_ptr_length, + uint32_t string_ptr_length, uint16_t offset, uint16_t length) { if (string_ptr_length < offset + length) { @@ -691,13 +691,13 @@ static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr, return CFX_ByteStringC(string_ptr + offset, length); } CFX_ByteString GetNameFromTT(const uint8_t* name_table, - FX_DWORD name_table_size, - FX_DWORD name_id) { + uint32_t name_table_size, + uint32_t name_id) { if (!name_table || name_table_size < 6) { return CFX_ByteString(); } - FX_DWORD name_count = GET_TT_SHORT(name_table + 2); - FX_DWORD string_offset = GET_TT_SHORT(name_table + 4); + uint32_t name_count = GET_TT_SHORT(name_table + 2); + uint32_t string_offset = GET_TT_SHORT(name_table + 4); // We will ignore the possibility of overlap of structures and // string table as if it's all corrupt there's not a lot we can do. if (name_table_size < string_offset) { @@ -705,14 +705,14 @@ CFX_ByteString GetNameFromTT(const uint8_t* name_table, } const uint8_t* string_ptr = name_table + string_offset; - FX_DWORD string_ptr_size = name_table_size - string_offset; + uint32_t string_ptr_size = name_table_size - string_offset; name_table += 6; name_table_size -= 6; if (name_table_size < name_count * 12) { return CFX_ByteString(); } - for (FX_DWORD i = 0; i < name_count; i++, name_table += 12) { + for (uint32_t i = 0; i < name_count; i++, name_table += 12) { if (GET_TT_SHORT(name_table + 6) == name_id && GET_TT_SHORT(name_table) == 1 && GET_TT_SHORT(name_table + 2) == 0) { return GetStringFromTable(string_ptr, string_ptr_size, @@ -727,13 +727,13 @@ CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) { if (!m_pFontInfo) return CFX_ByteString(); - FX_DWORD size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0); + uint32_t size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0); if (!size) return CFX_ByteString(); std::vector<uint8_t> buffer(size); uint8_t* buffer_ptr = buffer.data(); - FX_DWORD bytes_read = + uint32_t bytes_read = m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6) : CFX_ByteString(); @@ -743,8 +743,8 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { if (!m_pFontInfo) { return; } - if (m_CharsetArray.Find((FX_DWORD)charset) == -1) { - m_CharsetArray.Add((FX_DWORD)charset); + if (m_CharsetArray.Find((uint32_t)charset) == -1) { + m_CharsetArray.Add((uint32_t)charset); m_FaceArray.push_back(name); } if (name == m_LastFamily) { @@ -820,7 +820,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, return m_FoxitFaces[iBaseFont]; } const uint8_t* pFontData = NULL; - FX_DWORD size = 0; + uint32_t size = 0; if (m_pFontMgr->GetBuiltinFont(iBaseFont, &pFontData, &size)) { m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_FoxitFaces[iBaseFont]; @@ -838,7 +838,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, return m_MMFaces[1]; } const uint8_t* pFontData = NULL; - FX_DWORD size = 0; + uint32_t size = 0; m_pFontMgr->GetBuiltinFont(14, &pFontData, &size); m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_MMFaces[1]; @@ -848,7 +848,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, return m_MMFaces[0]; } const uint8_t* pFontData = NULL; - FX_DWORD size = 0; + uint32_t size = 0; m_pFontMgr->GetBuiltinFont(15, &pFontData, &size); m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_MMFaces[0]; @@ -856,7 +856,7 @@ FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTrueType, - FX_DWORD flags, + uint32_t flags, int weight, int italic_angle, int WindowCP, @@ -881,7 +881,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, return m_FoxitFaces[12]; } const uint8_t* pFontData = NULL; - FX_DWORD size = 0; + uint32_t size = 0; m_pFontMgr->GetBuiltinFont(12, &pFontData, &size); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_FoxitFaces[12]; @@ -894,7 +894,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, return m_FoxitFaces[13]; } const uint8_t* pFontData = NULL; - FX_DWORD size = 0; + uint32_t size = 0; m_pFontMgr->GetBuiltinFont(13, &pFontData, &size); m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_FoxitFaces[13]; @@ -918,7 +918,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, } int PitchFamily = 0; FX_BOOL bItalic = FALSE; - FX_DWORD nStyle = 0; + uint32_t nStyle = 0; FX_BOOL bStyleAvail = FALSE; if (iBaseFont < 12) { family = g_Base14FontNames[iBaseFont]; @@ -1139,7 +1139,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, return m_FoxitFaces[12]; } const uint8_t* pFontData = NULL; - FX_DWORD size = 0; + uint32_t size = 0; m_pFontMgr->GetBuiltinFont(12, &pFontData, &size); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_FoxitFaces[12]; @@ -1170,8 +1170,8 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, if (Charset == FXFONT_DEFAULT_CHARSET) { m_pFontInfo->GetFontCharset(hFont, Charset); } - FX_DWORD ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0); - FX_DWORD font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0); + uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0); + uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0); if (font_size == 0 && ttc_size == 0) { m_pFontInfo->DeleteFont(hFont); return nullptr; @@ -1180,9 +1180,9 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, if (ttc_size) { uint8_t temp[1024]; m_pFontInfo->GetFontData(hFont, kTableTTCF, temp, 1024); - FX_DWORD checksum = 0; + uint32_t checksum = 0; for (int i = 0; i < 256; i++) { - checksum += ((FX_DWORD*)temp)[i]; + checksum += ((uint32_t*)temp)[i]; } uint8_t* pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, @@ -1239,8 +1239,8 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, return face; } #ifdef PDF_ENABLE_XFA -FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, - FX_DWORD flags, +FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode, + uint32_t flags, int weight, int italic_angle) { if (m_pFontInfo == NULL) { @@ -1262,8 +1262,8 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, if (hFont == NULL) { return NULL; } - FX_DWORD ttc_size = m_pFontInfo->GetFontData(hFont, 0x74746366, NULL, 0); - FX_DWORD font_size = m_pFontInfo->GetFontData(hFont, 0, NULL, 0); + uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, 0x74746366, NULL, 0); + uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, NULL, 0); if (font_size == 0 && ttc_size == 0) { m_pFontInfo->DeleteFont(hFont); return NULL; @@ -1272,9 +1272,9 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, if (ttc_size) { uint8_t temp[1024]; m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024); - FX_DWORD checksum = 0; + uint32_t checksum = 0; for (int i = 0; i < 256; i++) { - checksum += ((FX_DWORD*)temp)[i]; + checksum += ((uint32_t*)temp)[i]; } uint8_t* pFontData; face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, @@ -1308,7 +1308,7 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, return face; } -void* IFX_SystemFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, +void* IFX_SystemFontInfo::MapFontByUnicode(uint32_t dwUnicode, int weight, FX_BOOL bItalic, int pitch_family) { @@ -1415,7 +1415,7 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { return; } FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); - FX_DWORD filesize = FXSYS_ftell(pFile); + uint32_t filesize = FXSYS_ftell(pFile); uint8_t buffer[16]; FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); @@ -1425,12 +1425,12 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { } if (GET_TT_LONG(buffer) == kTableTTCF) { - FX_DWORD nFaces = GET_TT_LONG(buffer + 8); - if (nFaces > std::numeric_limits<FX_DWORD>::max() / 4) { + uint32_t nFaces = GET_TT_LONG(buffer + 8); + if (nFaces > std::numeric_limits<uint32_t>::max() / 4) { FXSYS_fclose(pFile); return; } - FX_DWORD face_bytes = nFaces * 4; + uint32_t face_bytes = nFaces * 4; uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile); if (readCnt != face_bytes) { @@ -1438,7 +1438,7 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { FXSYS_fclose(pFile); return; } - for (FX_DWORD i = 0; i < nFaces; i++) { + for (uint32_t i = 0; i < nFaces; i++) { uint8_t* p = offsets + i * 4; ReportFace(path, pFile, filesize, GET_TT_LONG(p)); } @@ -1450,14 +1450,14 @@ void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { } void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path, FXSYS_FILE* pFile, - FX_DWORD filesize, - FX_DWORD offset) { + uint32_t filesize, + uint32_t offset) { FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); char buffer[16]; if (!FXSYS_fread(buffer, 12, 1, pFile)) { return; } - FX_DWORD nTables = GET_TT_SHORT(buffer + 4); + uint32_t nTables = GET_TT_SHORT(buffer + 4); CFX_ByteString tables = FPDF_ReadStringFromFile(pFile, nTables * 16); if (tables.IsEmpty()) { return; @@ -1483,7 +1483,7 @@ void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path, CFX_ByteString os2 = FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); if (os2.GetLength() >= 86) { const uint8_t* p = (const uint8_t*)os2 + 78; - FX_DWORD codepages = GET_TT_LONG(p); + uint32_t codepages = GET_TT_LONG(p); if (codepages & (1 << 17)) { m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET); pInfo->m_Charsets |= CHARSET_FLAG_SHIFTJIS; @@ -1540,7 +1540,7 @@ void* CFX_FolderFontInfo::FindFont(int weight, if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) { return GetFont("Courier New"); } - FX_DWORD charset_flag = GetCharset(charset); + uint32_t charset_flag = GetCharset(charset); int32_t iBestSimilar = 0; for (const auto& it : m_FontList) { const CFX_ByteString& bsName = it.first; @@ -1572,7 +1572,7 @@ void* CFX_FolderFontInfo::MapFont(int weight, } #ifdef PDF_ENABLE_XFA -void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, +void* CFX_FolderFontInfo::MapFontByUnicode(uint32_t dwUnicode, int weight, FX_BOOL bItalic, int pitch_family) { @@ -1585,23 +1585,23 @@ void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { return it != m_FontList.end() ? it->second : nullptr; } -FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, - FX_DWORD table, +uint32_t CFX_FolderFontInfo::GetFontData(void* hFont, + uint32_t table, uint8_t* buffer, - FX_DWORD size) { + uint32_t size) { if (!hFont) return 0; const CFX_FontFaceInfo* pFont = static_cast<CFX_FontFaceInfo*>(hFont); - FX_DWORD datasize = 0; - FX_DWORD offset = 0; + uint32_t datasize = 0; + uint32_t offset = 0; if (table == 0) { datasize = pFont->m_FontOffset ? 0 : pFont->m_FileSize; } else if (table == kTableTTCF) { datasize = pFont->m_FontOffset ? pFont->m_FileSize : 0; } else { - FX_DWORD nTables = pFont->m_FontTables.GetLength() / 16; - for (FX_DWORD i = 0; i < nTables; i++) { + uint32_t nTables = pFont->m_FontTables.GetLength() / 16; + for (uint32_t i = 0; i < nTables; i++) { const uint8_t* p = static_cast<const uint8_t*>(pFont->m_FontTables) + i * 16; if (GET_TT_LONG(p) == table) { diff --git a/core/fxge/ge/fx_ge_ps.cpp b/core/fxge/ge/fx_ge_ps.cpp index 2470025852..32f2fce914 100644 --- a/core/fxge/ge/fx_ge_ps.cpp +++ b/core/fxge/ge/fx_ge_ps.cpp @@ -11,7 +11,7 @@ struct PSGlyph { CFX_Font* m_pFont; - FX_DWORD m_GlyphIndex; + uint32_t m_GlyphIndex; FX_BOOL m_bGlyphAdjust; FX_FLOAT m_AdjustMatrix[4]; }; @@ -178,8 +178,8 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData, FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform) { @@ -275,7 +275,7 @@ static void FaxCompressData(uint8_t* src_buf, int width, int height, uint8_t*& dest_buf, - FX_DWORD& dest_size) { + uint32_t& dest_size) { CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (width * height > 128 && pEncoders && pEncoders->GetFaxModule()->Encode(src_buf, width, height, (width + 7) / 8, @@ -288,9 +288,9 @@ static void FaxCompressData(uint8_t* src_buf, } static void PSCompressData(int PSLevel, uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& output_buf, - FX_DWORD& output_size, + uint32_t& output_size, const FX_CHAR*& filter) { output_buf = src_buf; output_size = src_size; @@ -300,7 +300,7 @@ static void PSCompressData(int PSLevel, } CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); uint8_t* dest_buf = NULL; - FX_DWORD dest_size = src_size; + uint32_t dest_size = src_size; if (PSLevel >= 3) { if (pEncoders && pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, @@ -323,7 +323,7 @@ static void PSCompressData(int PSLevel, } } FX_BOOL CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, int left, int top, int alpha_flag, @@ -335,12 +335,12 @@ FX_BOOL CFX_PSRenderer::SetDIBits(const CFX_DIBSource* pSource, return DrawDIBits(pSource, color, &matrix, 0, alpha_flag, pIccTransform); } FX_BOOL CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform) { StartRendering(); @@ -350,9 +350,9 @@ FX_BOOL CFX_PSRenderer::StretchDIBits(const CFX_DIBSource* pSource, return DrawDIBits(pSource, color, &matrix, flags, alpha_flag, pIccTransform); } FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform) { StartRendering(); @@ -377,14 +377,14 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, buf << width << " " << height; if (pSource->GetBPP() == 1 && !pSource->GetPalette()) { int pitch = (width + 7) / 8; - FX_DWORD src_size = height * pitch; + uint32_t src_size = height * pitch; uint8_t* src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row++) { const uint8_t* src_scan = pSource->GetScanline(row); FXSYS_memcpy(src_buf + row * pitch, src_scan, pitch); } uint8_t* output_buf; - FX_DWORD output_size; + uint32_t output_size; FaxCompressData(src_buf, width, height, output_buf, output_size); if (pSource->IsAlphaMask()) { SetColor(color, alpha_flag, pIccTransform); @@ -469,7 +469,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, } } uint8_t* compressed_buf; - FX_DWORD compressed_size; + uint32_t compressed_size; PSCompressData(m_PSLevel, output_buf, output_size, compressed_buf, compressed_size, filter); if (output_buf != compressed_buf) { @@ -497,7 +497,7 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource, OUTPUT_PS("\nQ\n"); return TRUE; } -void CFX_PSRenderer::SetColor(FX_DWORD color, +void CFX_PSRenderer::SetColor(uint32_t color, int alpha_flag, void* pIccTransform) { if (!CFX_GEModule::Get()->GetCodecModule() || @@ -646,7 +646,7 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars, CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { StartRendering(); @@ -688,7 +688,7 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars, } void CFX_PSRenderer::WritePSBinary(const uint8_t* data, int len) { uint8_t* dest_buf; - FX_DWORD dest_size; + uint32_t dest_size; CCodec_ModuleMgr* pEncoders = CFX_GEModule::Get()->GetCodecModule(); if (pEncoders && pEncoders->GetBasicModule()->A85Encode(data, len, dest_buf, dest_size)) { diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index bcc630ca71..10c769aa6b 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -138,7 +138,7 @@ static const uint8_t g_TextGammaAdjust[256] = { #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ src_alpha = g_TextGammaAdjust[(uint8_t)src_alpha]; void _Color2Argb(FX_ARGB& argb, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { if (!pIccTransform && !FXGETFLAG_COLORTYPE(alpha_flag)) { @@ -177,8 +177,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, CFX_FontCache* pCache, FX_FLOAT font_size, const CFX_Matrix* pText2Device, - FX_DWORD fill_color, - FX_DWORD text_flags, + uint32_t fill_color, + uint32_t text_flags, int alpha_flag, void* pIccTransform) { int nativetext_flags = text_flags; @@ -1114,7 +1114,7 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars, const CFX_Matrix* pText2User, const CFX_Matrix* pUser2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, + uint32_t fill_color, FX_ARGB stroke_color, CFX_PathData* pClippingPath, int nFlag, @@ -1256,7 +1256,7 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( CFX_Font* pFont, const CFX_Matrix* pMatrix, CFX_ByteStringC& FaceGlyphsKey, - FX_DWORD glyph_index, + uint32_t glyph_index, FX_BOOL bFontStyle, int dest_width, int anti_alias) { @@ -1281,13 +1281,13 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( return pGlyphBitmap; } const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, FX_BOOL bFontStyle, const CFX_Matrix* pMatrix, int dest_width, int anti_alias, int& text_flags) { - if (glyph_index == (FX_DWORD)-1) { + if (glyph_index == (uint32_t)-1) { return NULL; } _CFX_UniqueKeyGen keygen; @@ -1512,7 +1512,7 @@ static void _ContrastAdjust(uint8_t* pDataIn, } } CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, FX_BOOL bFontStyle, const CFX_Matrix* pMatrix, int dest_width, @@ -1647,12 +1647,12 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, return pGlyphBitmap; } const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, int dest_width) { - if (!m_Face || glyph_index == (FX_DWORD)-1) + if (!m_Face || glyph_index == (uint32_t)-1) return nullptr; - FX_DWORD key = glyph_index; + uint32_t key = glyph_index; if (pFont->GetSubstFont()) { key += (((pFont->GetSubstFont()->m_Weight / 16) << 15) + ((pFont->GetSubstFont()->m_ItalicAngle / 2) << 21) + @@ -1792,7 +1792,7 @@ static int _Outline_CubicTo(const FXFT_Vector* control1, return 0; } }; -CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) { +CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, int dest_width) { if (!m_Face) { return NULL; } @@ -1868,8 +1868,8 @@ void _CFX_UniqueKeyGen::Generate(int count, ...) { va_start(argList, count); for (int i = 0; i < count; i++) { int p = va_arg(argList, int); - ((FX_DWORD*)m_Key)[i] = p; + ((uint32_t*)m_Key)[i] = p; } va_end(argList); - m_KeyLen = count * sizeof(FX_DWORD); + m_KeyLen = count * sizeof(uint32_t); } diff --git a/core/fxge/ge/fx_text_int.h b/core/fxge/ge/fx_text_int.h index d88b2a7cb9..04587c37cb 100644 --- a/core/fxge/ge/fx_text_int.h +++ b/core/fxge/ge/fx_text_int.h @@ -21,7 +21,7 @@ class CFX_SizeGlyphCache { public: CFX_SizeGlyphCache() {} ~CFX_SizeGlyphCache(); - std::map<FX_DWORD, CFX_GlyphBitmap*> m_GlyphMap; + std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap; }; class CTTFontDesc { public: @@ -62,8 +62,8 @@ class CFX_FontFaceInfo { CFX_FontFaceInfo(CFX_ByteString filePath, CFX_ByteString faceName, CFX_ByteString fontTables, - FX_DWORD fontOffset, - FX_DWORD fileSize) + uint32_t fontOffset, + uint32_t fileSize) : m_FilePath(filePath), m_FaceName(faceName), m_FontTables(fontTables), @@ -75,10 +75,10 @@ class CFX_FontFaceInfo { const CFX_ByteString m_FilePath; const CFX_ByteString m_FaceName; const CFX_ByteString m_FontTables; - const FX_DWORD m_FontOffset; - const FX_DWORD m_FileSize; - FX_DWORD m_Styles; - FX_DWORD m_Charsets; + const uint32_t m_FontOffset; + const uint32_t m_FileSize; + uint32_t m_Styles; + uint32_t m_Charsets; }; #endif // CORE_FXGE_GE_FX_TEXT_INT_H_ diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index ed6ff82fd0..745c9b50fd 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -317,7 +317,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromStream( @@ -430,8 +430,8 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath( const CFX_PathData* pPathData, // path info const CFX_Matrix* pObject2Device, // optional transformation const CFX_GraphStateData* pGraphState, // graphic state, for pen attributes - FX_DWORD fill_color, // fill color - FX_DWORD stroke_color, // stroke color + uint32_t fill_color, // fill color + uint32_t stroke_color, // stroke color int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled int alpha_flag, void* pIccTransform, @@ -483,7 +483,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath( } FX_BOOL CFX_SkiaDeviceDriver::FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag, void* pIccTransform, int blend_type) { @@ -583,7 +583,7 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap, } FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD argb, + uint32_t argb, const FX_RECT* pSrcRect, int left, int top, @@ -596,13 +596,13 @@ FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap, } FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, - FX_DWORD argb, + uint32_t argb, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) { @@ -614,9 +614,9 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, - FX_DWORD argb, + uint32_t argb, const CFX_Matrix* pMatrix, - FX_DWORD render_flags, + uint32_t render_flags, void*& handle, int alpha_flag, void* pIccTransform, diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index 8ce7c6c61f..afc505da6e 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -50,15 +50,15 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override; FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override; @@ -68,7 +68,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override { @@ -87,7 +87,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { CFX_DIBitmap* GetBackDrop() override { return m_pAggDriver->GetBackDrop(); } FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int dest_left, int dest_top, @@ -95,22 +95,22 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { int alpha_flag = 0, void* pIccTransform = NULL) override; FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) override; FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, @@ -124,7 +124,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL) override; diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h index 62672b2387..60cc981a48 100644 --- a/core/fxge/win32/dwrite_int.h +++ b/core/fxge/win32/dwrite_int.h @@ -37,7 +37,7 @@ class CDWriteExt { FX_BOOL IsAvailable() { return m_pDWriteFactory != NULL; } void* DwCreateFontFaceFromStream(uint8_t* pData, - FX_DWORD size, + uint32_t size, int simulation_style); FX_BOOL DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget); void DwDeleteRenderingTarget(void* renderTarget); diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 9b43fae09e..cb3f331d49 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -43,17 +43,17 @@ class CFX_Win32FontInfo final : public IFX_SystemFontInfo { const FX_CHAR* face, int& iExact) override; void* GetFont(const FX_CHAR* face) override { return NULL; } - FX_DWORD GetFontData(void* hFont, - FX_DWORD table, + uint32_t GetFontData(void* hFont, + uint32_t table, uint8_t* buffer, - FX_DWORD size) override; + uint32_t size) override; FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; FX_BOOL GetFontCharset(void* hFont, int& charset) override; void DeleteFont(void* hFont) override; FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf); FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf); - void AddInstalledFont(const LOGFONTA* plf, FX_DWORD FontType); + void AddInstalledFont(const LOGFONTA* plf, uint32_t FontType); void GetGBPreference(CFX_ByteString& face, int weight, int picth_family); void GetJapanesePreference(CFX_ByteString& face, int weight, @@ -76,18 +76,18 @@ void CFX_Win32FontInfo::Release() { delete this; } #define TT_MAKE_TAG(x1, x2, x3, x4) \ - (((FX_DWORD)x1 << 24) | ((FX_DWORD)x2 << 16) | ((FX_DWORD)x3 << 8) | \ - (FX_DWORD)x4) + (((uint32_t)x1 << 24) | ((uint32_t)x2 << 16) | ((uint32_t)x3 << 8) | \ + (uint32_t)x4) FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) { HFONT hFont = CreateFontIndirectA(plf); FX_BOOL ret = FALSE; - FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); - if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { - FX_DWORD lVersion = 0; - GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); - lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | - ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | - ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | + uint32_t font_size = GetFontData(hFont, 0, NULL, 0); + if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) { + uint32_t lVersion = 0; + GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(uint32_t)); + lVersion = (((uint32_t)(uint8_t)(lVersion)) << 24) | + ((uint32_t)((uint8_t)(lVersion >> 8))) << 16 | + ((uint32_t)((uint8_t)(lVersion >> 16))) << 8 | ((uint8_t)(lVersion >> 24)); if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || @@ -101,13 +101,13 @@ FX_BOOL CFX_Win32FontInfo::IsOpenTypeFromDiv(const LOGFONTA* plf) { FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { HFONT hFont = CreateFontIndirectA(plf); FX_BOOL ret = FALSE; - FX_DWORD font_size = GetFontData(hFont, 0, NULL, 0); - if (font_size != GDI_ERROR && font_size >= sizeof(FX_DWORD)) { - FX_DWORD lVersion = 0; - GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(FX_DWORD)); - lVersion = (((FX_DWORD)(uint8_t)(lVersion)) << 24) | - ((FX_DWORD)((uint8_t)(lVersion >> 8))) << 16 | - ((FX_DWORD)((uint8_t)(lVersion >> 16))) << 8 | + uint32_t font_size = GetFontData(hFont, 0, NULL, 0); + if (font_size != GDI_ERROR && font_size >= sizeof(uint32_t)) { + uint32_t lVersion = 0; + GetFontData(hFont, 0, (uint8_t*)(&lVersion), sizeof(uint32_t)); + lVersion = (((uint32_t)(uint8_t)(lVersion)) << 24) | + ((uint32_t)((uint8_t)(lVersion >> 8))) << 16 | + ((uint32_t)((uint8_t)(lVersion >> 16))) << 8 | ((uint8_t)(lVersion >> 24)); if (lVersion == TT_MAKE_TAG('O', 'T', 'T', 'O') || lVersion == 0x00010000 || lVersion == TT_MAKE_TAG('t', 't', 'c', 'f') || @@ -122,7 +122,7 @@ FX_BOOL CFX_Win32FontInfo::IsSupportFontFormDiv(const LOGFONTA* plf) { return ret; } void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf, - FX_DWORD FontType) { + uint32_t FontType) { CFX_ByteString name(plf->lfFaceName); if (name[0] == '@') { return; @@ -144,7 +144,7 @@ void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf, } static int CALLBACK FontEnumProc(const LOGFONTA* plf, const TEXTMETRICA* lpntme, - FX_DWORD FontType, + uint32_t FontType, LPARAM lParam) { CFX_Win32FontInfo* pFontInfo = (CFX_Win32FontInfo*)lParam; if (pFontInfo->m_pMapper->GetFontEnumerator()) { @@ -406,10 +406,10 @@ void* CFX_Win32FontInfo::MapFont(int weight, void CFX_Win32FontInfo::DeleteFont(void* hFont) { ::DeleteObject(hFont); } -FX_DWORD CFX_Win32FontInfo::GetFontData(void* hFont, - FX_DWORD table, +uint32_t CFX_Win32FontInfo::GetFontData(void* hFont, + uint32_t table, uint8_t* buffer, - FX_DWORD size) { + uint32_t size) { HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); table = FXDWORD_GET_MSBFIRST(reinterpret_cast<uint8_t*>(&table)); size = ::GetFontData(m_hDC, table, 0, buffer, size); @@ -581,7 +581,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int dest_top, int dest_width, int dest_height, - FX_DWORD flags, + uint32_t flags, void* pIccTransform) { CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; if (!pBitmap || dest_width == 0 || dest_height == 0) { @@ -624,8 +624,8 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int dest_top, int dest_width, int dest_height, - FX_DWORD bitmap_color, - FX_DWORD flags, + uint32_t bitmap_color, + uint32_t flags, int alpha_flag, void* pIccTransform) { CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; @@ -637,7 +637,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int width = pBitmap->GetWidth(), height = pBitmap->GetHeight(); struct { BITMAPINFOHEADER bmiHeader; - FX_DWORD bmiColors[2]; + uint32_t bmiColors[2]; } bmi; FXSYS_memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -691,7 +691,7 @@ FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) { } static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_Matrix* pMatrix, - FX_DWORD argb) { + uint32_t argb) { FX_FLOAT width; FX_FLOAT scale = 1.f; if (pMatrix) @@ -703,7 +703,7 @@ static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, } else { width = 1.0f; } - FX_DWORD PenStyle = PS_GEOMETRIC; + uint32_t PenStyle = PS_GEOMETRIC; if (width < 1) { width = 1; } @@ -741,9 +741,9 @@ static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, lb.lbColor = rgb; lb.lbStyle = BS_SOLID; lb.lbHatch = 0; - FX_DWORD* pDash = NULL; + uint32_t* pDash = NULL; if (pGraphState->m_DashCount) { - pDash = FX_Alloc(FX_DWORD, pGraphState->m_DashCount); + pDash = FX_Alloc(uint32_t, pGraphState->m_DashCount); for (int i = 0; i < pGraphState->m_DashCount; i++) { pDash[i] = FXSYS_round( pMatrix ? pMatrix->TransformDistance(pGraphState->m_DashArray[i]) @@ -758,7 +758,7 @@ static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, FX_Free(pDash); return hPen; } -static HBRUSH _CreateBrush(FX_DWORD argb) { +static HBRUSH _CreateBrush(uint32_t argb) { int a; FX_COLORREF rgb; ArgbDecode(argb, a, rgb); @@ -851,8 +851,8 @@ static FX_BOOL _MatrixNoScaled(const CFX_Matrix* pMatrix) { FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pMatrix, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, @@ -961,7 +961,7 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData, return TRUE; } FX_BOOL CGdiDeviceDriver::FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag, void* pIccTransform, int blend_type) { @@ -1017,7 +1017,7 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform, int blend_type) { @@ -1098,7 +1098,7 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, return ret; } FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int left, int top, @@ -1152,7 +1152,7 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, return FALSE; } FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, @@ -1183,13 +1183,13 @@ FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource, return ret; } FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) { @@ -1265,7 +1265,7 @@ int GetPSLevel(HDC hDC) { if (device_type != DT_RASPRINTER) { return 0; } - FX_DWORD esc = GET_PS_FEATURESETTING; + uint32_t esc = GET_PS_FEATURESETTING; if (ExtEscape(hDC, QUERYESCSUPPORT, sizeof esc, (char*)&esc, 0, NULL)) { int param = FEATURESETTING_PSLEVEL; if (ExtEscape(hDC, GET_PS_FEATURESETTING, sizeof(int), (char*)¶m, @@ -1282,7 +1282,7 @@ int GetPSLevel(HDC hDC) { return 0; } esc = PSIDENT_GDICENTRIC; - if (ExtEscape(hDC, POSTSCRIPT_IDENTIFY, sizeof(FX_DWORD), (char*)&esc, 0, + if (ExtEscape(hDC, POSTSCRIPT_IDENTIFY, sizeof(uint32_t), (char*)&esc, 0, NULL) <= 0) { return 2; } diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index cd48d07554..cc627dbab0 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -27,7 +27,7 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) { pbmih->biPlanes = 1; pbmih->biWidth = pBitmap->GetWidth(); if (pBitmap->GetBPP() == 8) { - FX_DWORD* pPalette = (FX_DWORD*)(pbmih + 1); + uint32_t* pPalette = (uint32_t*)(pbmih + 1); if (pBitmap->GetPalette()) { for (int i = 0; i < 256; i++) { pPalette[i] = pBitmap->GetPalette()[i]; @@ -39,7 +39,7 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) { } } if (pBitmap->GetBPP() == 1) { - FX_DWORD* pPalette = (FX_DWORD*)(pbmih + 1); + uint32_t* pPalette = (uint32_t*)(pbmih + 1); if (pBitmap->GetPalette()) { pPalette[0] = pBitmap->GetPalette()[0]; pPalette[1] = pBitmap->GetPalette()[1]; @@ -88,11 +88,11 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, } if (pbmi->bmiHeader.biBitCount == 1) { for (int i = 0; i < 2; i++) { - pBitmap->SetPaletteEntry(i, ((FX_DWORD*)pbmi->bmiColors)[i] | 0xff000000); + pBitmap->SetPaletteEntry(i, ((uint32_t*)pbmi->bmiColors)[i] | 0xff000000); } } else if (pbmi->bmiHeader.biBitCount == 8) { for (int i = 0; i < 256; i++) { - pBitmap->SetPaletteEntry(i, ((FX_DWORD*)pbmi->bmiColors)[i] | 0xff000000); + pBitmap->SetPaletteEntry(i, ((uint32_t*)pbmi->bmiColors)[i] | 0xff000000); } } return pBitmap; @@ -182,8 +182,8 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) { } CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, - FX_DWORD* pPalette, - FX_DWORD palsize) { + uint32_t* pPalette, + uint32_t palsize) { FX_BOOL bCreatedDC = !hDC; if (bCreatedDC) { hDC = CreateCompatibleDC(NULL); @@ -201,7 +201,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, if (bmih.biBitCount == 1 || bmih.biBitCount == 8) { int size = sizeof(BITMAPINFOHEADER) + 8; if (bmih.biBitCount == 8) { - size += sizeof(FX_DWORD) * 254; + size += sizeof(uint32_t) * 254; } BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(uint8_t, size); pbmih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp index 972295c5cc..f95b5eb4a3 100644 --- a/core/fxge/win32/fx_win32_dwrite.cpp +++ b/core/fxge/win32/fx_win32_dwrite.cpp @@ -127,7 +127,7 @@ CDWriteExt::~CDWriteExt() { Unload(); } LPVOID CDWriteExt::DwCreateFontFaceFromStream(uint8_t* pData, - FX_DWORD size, + uint32_t size, int simulation_style) { IDWriteFactory* pDwFactory = (IDWriteFactory*)m_pDWriteFactory; IDWriteFontFile* pDwFontFile = NULL; diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 2fdfa3a8c7..b9c2190041 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -437,9 +437,9 @@ typedef HANDLE(__stdcall* FuncType_GdiAddFontMemResourceEx)(PVOID pbFont, DWORD* pcFonts); typedef BOOL(__stdcall* FuncType_GdiRemoveFontMemResourceEx)(HANDLE handle); void* CGdiplusExt::GdiAddFontMemResourceEx(void* pFontdata, - FX_DWORD size, + uint32_t size, void* pdv, - FX_DWORD* num_face) { + uint32_t* num_face) { if (m_pGdiAddFontMemResourceEx) { return ((FuncType_GdiAddFontMemResourceEx)m_pGdiAddFontMemResourceEx)( (PVOID)pFontdata, (DWORD)size, (PVOID)pdv, (DWORD*)num_face); @@ -711,7 +711,7 @@ void CGdiplusExt::Load() { GetProcAddress(m_GdiModule, "RemoveFontMemResourceEx"); } CGdiplusExt::~CGdiplusExt() {} -LPVOID CGdiplusExt::LoadMemFont(LPBYTE pData, FX_DWORD size) { +LPVOID CGdiplusExt::LoadMemFont(LPBYTE pData, uint32_t size) { GpFontCollection* pCollection = NULL; CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; @@ -809,7 +809,7 @@ void CGdiplusExt::GdipSetTextRenderingHint(void* graphics, int mode) { CallFunc(GdipSetTextRenderingHint)((GpGraphics*)graphics, (TextRenderingHint)mode); } -void CGdiplusExt::GdipSetPageUnit(void* graphics, FX_DWORD unit) { +void CGdiplusExt::GdipSetPageUnit(void* graphics, uint32_t unit) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; CallFunc(GdipSetPageUnit)((GpGraphics*)graphics, (GpUnit)unit); @@ -833,7 +833,7 @@ FX_BOOL CGdiplusExt::GdipDrawDriverString(void* graphics, } return FALSE; } -void CGdiplusExt::GdipCreateBrush(FX_DWORD fill_argb, void** pBrush) { +void CGdiplusExt::GdipCreateBrush(uint32_t fill_argb, void** pBrush) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; CallFunc(GdipCreateSolidFill)((ARGB)fill_argb, (GpSolidFill**)pBrush); @@ -916,7 +916,7 @@ FX_BOOL CGdiplusExt::StretchBitMask(HDC hDC, int dest_top, int dest_width, int dest_height, - FX_DWORD argb, + uint32_t argb, const FX_RECT* pClipRect, int flags) { ASSERT(pBitmap->GetBPP() == 1); @@ -1100,8 +1100,8 @@ FX_BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_argb, - FX_DWORD stroke_argb, + uint32_t fill_argb, + uint32_t stroke_argb, int fill_mode) { int nPoints = pPathData->GetPointCount(); if (nPoints == 0) { diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index f7a1bb69a0..cb5ce771a3 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -34,7 +34,7 @@ int CGdiPrinterDriver::GetDeviceCaps(int caps_id) { return CGdiDeviceDriver::GetDeviceCaps(caps_id); } FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int left, int top, @@ -62,13 +62,13 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource, return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform); } FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) { @@ -147,7 +147,7 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, } int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight(); uint8_t* src_buf = pSrcBitmap->GetBuffer(); - FX_DWORD src_pitch = pSrcBitmap->GetPitch(); + uint32_t src_pitch = pSrcBitmap->GetPitch(); FX_FLOAT dest_area = pDestMatrix->GetUnitArea(); FX_FLOAT area_scale = ((FX_FLOAT)(src_width * src_height)) / dest_area; FX_FLOAT size_scale = FXSYS_sqrt(area_scale); @@ -222,9 +222,9 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, } FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD render_flags, + uint32_t render_flags, void*& handle, int alpha_flag, void* pIccTransform, @@ -330,7 +330,7 @@ FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) { if (ret) { CFX_PathData path; path.AllocPointCount(pData->rdh.nCount * 5); - for (FX_DWORD i = 0; i < pData->rdh.nCount; i++) { + for (uint32_t i = 0; i < pData->rdh.nCount; i++) { RECT* pRect = (RECT*)(pData->Buffer + pData->rdh.nRgnSize * i); path.AppendRect((FX_FLOAT)pRect->left, (FX_FLOAT)pRect->bottom, (FX_FLOAT)pRect->right, (FX_FLOAT)pRect->top); @@ -408,7 +408,7 @@ FX_BOOL CPSPrinterDriver::GetClipBox(FX_RECT* pRect) { return TRUE; } FX_BOOL CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int left, int top, @@ -422,13 +422,13 @@ FX_BOOL CPSPrinterDriver::SetDIBits(const CFX_DIBSource* pBitmap, pIccTransform); } FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) { @@ -441,9 +441,9 @@ FX_BOOL CPSPrinterDriver::StretchDIBits(const CFX_DIBSource* pBitmap, } FX_BOOL CPSPrinterDriver::StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD render_flags, + uint32_t render_flags, void*& handle, int alpha_flag, void* pIccTransform, @@ -464,7 +464,7 @@ FX_BOOL CPSPrinterDriver::DrawDeviceText(int nChars, CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) { return m_PSRenderer.DrawText(nChars, pCharPos, pFont, pCache, pObject2Device, diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index d903d3abf5..18996afc5c 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -24,7 +24,7 @@ class CGdiplusExt { int dest_top, int dest_width, int dest_height, - FX_DWORD argb, + uint32_t argb, const FX_RECT* pClipRect, int flags); FX_BOOL StretchDIBits(HDC hDC, @@ -39,16 +39,16 @@ class CGdiplusExt { const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_argb, - FX_DWORD stroke_argb, + uint32_t fill_argb, + uint32_t stroke_argb, int fill_mode); - void* LoadMemFont(uint8_t* pData, FX_DWORD size); + void* LoadMemFont(uint8_t* pData, uint32_t size); void DeleteMemFont(void* pFontCollection); FX_BOOL GdipCreateFromImage(void* bitmap, void** graphics); void GdipDeleteGraphics(void* graphics); void GdipSetTextRenderingHint(void* graphics, int mode); - void GdipSetPageUnit(void* graphics, FX_DWORD unit); + void GdipSetPageUnit(void* graphics, uint32_t unit); void GdipSetWorldTransform(void* graphics, void* pMatrix); FX_BOOL GdipDrawDriverString(void* graphics, unsigned short* text, @@ -58,7 +58,7 @@ class CGdiplusExt { void* positions, int flags, const void* matrix); - void GdipCreateBrush(FX_DWORD fill_argb, void** pBrush); + void GdipCreateBrush(uint32_t fill_argb, void** pBrush); void GdipDeleteBrush(void* pBrush); void GdipCreateMatrix(FX_FLOAT a, FX_FLOAT b, @@ -85,9 +85,9 @@ class CGdiplusExt { void GdipDisposeImage(void* bitmap); void GdipGetFontSize(void* pFont, FX_FLOAT* size); void* GdiAddFontMemResourceEx(void* pFontdata, - FX_DWORD size, + uint32_t size, void* pdv, - FX_DWORD* num_face); + uint32_t* num_face); FX_BOOL GdiRemoveFontMemResourceEx(void* handle); void* m_Functions[100]; void* m_pGdiAddFontMemResourceEx; @@ -125,14 +125,14 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) override; FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag, void* pIccTransform, int blend_type) override; @@ -140,7 +140,7 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform, int blend_type) override; @@ -162,15 +162,15 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { int dest_top, int dest_width, int dest_height, - FX_DWORD flags, + uint32_t flags, void* pIccTransform); FX_BOOL GDI_StretchBitMask(const CFX_DIBitmap* pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, - FX_DWORD bitmap_color, - FX_DWORD flags, + uint32_t bitmap_color, + uint32_t flags, int alpha_flag, void* pIccTransform); HDC m_hDC; @@ -191,7 +191,7 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { void* pIccTransform = NULL, FX_BOOL bDEdge = FALSE) override; FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int left, int top, @@ -199,21 +199,21 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { int alpha_flag, void* pIccTransform) override; FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) override; FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD render_flags, + uint32_t render_flags, void*& handle, int alpha_flag, void* pIccTransform, @@ -221,7 +221,7 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { return FALSE; } FX_BOOL UseFoxitStretchEngine(const CFX_DIBSource* pSource, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, @@ -239,7 +239,7 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { protected: int GetDeviceCaps(int caps_id) override; FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int left, int top, @@ -247,21 +247,21 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { int alpha_flag, void* pIccTransform) override; FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) override; FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD render_flags, + uint32_t render_flags, void*& handle, int alpha_flag, void* pIccTransform, @@ -308,15 +308,15 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, int blend_type) override; FX_BOOL GetClipBox(FX_RECT* pRect) override; FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int left, int top, @@ -324,21 +324,21 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { int alpha_flag, void* pIccTransform) override; FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag, void* pIccTransform, int blend_type) override; FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD render_flags, + uint32_t render_flags, void*& handle, int alpha_flag, void* pIccTransform, @@ -349,7 +349,7 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform) override; void* GetPlatformSurface() const override { return (void*)m_hDC; } @@ -362,7 +362,7 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { CFX_PSRenderer m_PSRenderer; }; void _Color2Argb(FX_ARGB& argb, - FX_DWORD color, + uint32_t color, int alpha_flag, void* pIccTransform); diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 28d62effd4..87d1662c81 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -85,8 +85,8 @@ class CPDF_Bookmark { explicit CPDF_Bookmark(CPDF_Dictionary* pDict) : m_pDict(pDict) {} CPDF_Dictionary* GetDict() const { return m_pDict; } - FX_DWORD GetColorRef() const; - FX_DWORD GetFontStyle() const; + uint32_t GetColorRef() const; + uint32_t GetFontStyle() const; CFX_WideString GetTitle() const; CPDF_Dest GetDest(CPDF_Document* pDocument) const; CPDF_Action GetAction() const; @@ -111,7 +111,7 @@ class CPDF_Dest { CPDF_Object* GetObject() const { return m_pObj; } CFX_ByteString GetRemoteName(); int GetPageIndex(CPDF_Document* pDoc); - FX_DWORD GetPageObjNum(); + uint32_t GetPageObjNum(); int GetZoomMode(); FX_FLOAT GetParam(int index); @@ -154,9 +154,9 @@ class CPDF_ActionFields { public: explicit CPDF_ActionFields(const CPDF_Action* pAction) : m_pAction(pAction) {} - FX_DWORD GetFieldsCount() const; + uint32_t GetFieldsCount() const; std::vector<CPDF_Object*> GetAllFields() const; - CPDF_Object* GetField(FX_DWORD iIndex) const; + CPDF_Object* GetField(uint32_t iIndex) const; protected: const CPDF_Action* const m_pAction; @@ -204,7 +204,7 @@ class CPDF_Action { FX_BOOL GetMouseMap() const { return m_pDict->GetBooleanBy("IsMap"); } FX_BOOL GetHideStatus() const { return m_pDict->GetBooleanBy("H", TRUE); } CFX_ByteString GetNamedAction() const { return m_pDict->GetStringBy("N"); } - FX_DWORD GetFlags() const { return m_pDict->GetIntegerBy("Flags"); } + uint32_t GetFlags() const { return m_pDict->GetIntegerBy("Flags"); } CFX_WideString GetJavaScript() const; CPDF_Dictionary* GetAnnot() const; int32_t GetOperationType() const; @@ -213,8 +213,8 @@ class CPDF_Action { FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); } FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); } FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); } - FX_DWORD GetSubActionsCount() const; - CPDF_Action GetSubAction(FX_DWORD iIndex) const; + uint32_t GetSubActionsCount() const; + CPDF_Action GetSubAction(uint32_t iIndex) const; protected: CPDF_Dictionary* const m_pDict; @@ -306,7 +306,7 @@ class CPDF_LinkList { const std::vector<CPDF_Dictionary*>* GetPageLinks(CPDF_Page* pPage); void LoadPageLinks(CPDF_Page* pPage, std::vector<CPDF_Dictionary*>* pList); - std::map<FX_DWORD, std::vector<CPDF_Dictionary*>> m_PageMap; + std::map<uint32_t, std::vector<CPDF_Dictionary*>> m_PageMap; }; class CPDF_Link { @@ -342,7 +342,7 @@ class CPDF_Annot : public CFX_PrivateData { ~CPDF_Annot(); CFX_ByteString GetSubType() const; - FX_DWORD GetFlags() const; + uint32_t GetFlags() const; void GetRect(CFX_FloatRect& rect) const; const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } @@ -388,7 +388,7 @@ class CPDF_AnnotList { CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_Matrix* pMatrix, - FX_DWORD dwAnnotFlags, + uint32_t dwAnnotFlags, CPDF_RenderOptions* pOptions, FX_RECT* pClipRect); size_t Count() const { return m_AnnotList.size(); } @@ -487,9 +487,9 @@ class CPDF_InterForm : public CFX_PrivateData { FX_BOOL ValidateFieldName(const CPDF_FormControl* pControl, CFX_WideString& csNewFieldName); - FX_DWORD CountFields(const CFX_WideString& csFieldName = L""); + uint32_t CountFields(const CFX_WideString& csFieldName = L""); - CPDF_FormField* GetField(FX_DWORD index, + CPDF_FormField* GetField(uint32_t index, const CFX_WideString& csFieldName = L""); CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; @@ -515,9 +515,9 @@ class CPDF_InterForm : public CFX_PrivateData { int FindFieldInCalculationOrder(const CPDF_FormField* pField); - FX_DWORD CountFormFonts(); + uint32_t CountFormFonts(); - CPDF_Font* GetFormFont(FX_DWORD index, CFX_ByteString& csNameTag); + CPDF_Font* GetFormFont(uint32_t index, CFX_ByteString& csNameTag); CPDF_Font* GetFormFont(CFX_ByteString csNameTag); @@ -663,7 +663,7 @@ class CPDF_FormField { CFX_WideString GetFullName(); Type GetType() const { return m_Type; } - FX_DWORD GetFlags() const { return m_Flags; } + uint32_t GetFlags() const { return m_Flags; } CPDF_Dictionary* GetFieldDict() const { return m_pDict; } void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } @@ -684,7 +684,7 @@ class CPDF_FormField { CFX_WideString GetMappingName(); - FX_DWORD GetFieldFlags(); + uint32_t GetFieldFlags(); CFX_ByteString GetDefaultStyle(); @@ -781,7 +781,7 @@ class CPDF_FormField { FX_BOOL bNotify); CPDF_FormField::Type m_Type; - FX_DWORD m_Flags; + uint32_t m_Flags; CPDF_InterForm* m_pForm; CPDF_Dictionary* m_pDict; CFX_ArrayTemplate<CPDF_FormControl*> m_ControlList; diff --git a/core/include/fpdfdoc/fpdf_tagged.h b/core/include/fpdfdoc/fpdf_tagged.h index 28fe84b41a..d17b724d53 100644 --- a/core/include/fpdfdoc/fpdf_tagged.h +++ b/core/include/fpdfdoc/fpdf_tagged.h @@ -37,21 +37,21 @@ struct CPDF_StructKid { CPDF_Dictionary* m_pDict; } m_Element; struct { - FX_DWORD m_PageObjNum; + uint32_t m_PageObjNum; - FX_DWORD m_ContentId; + uint32_t m_ContentId; } m_PageContent; struct { - FX_DWORD m_PageObjNum; + uint32_t m_PageObjNum; - FX_DWORD m_ContentId; + uint32_t m_ContentId; - FX_DWORD m_RefObjNum; + uint32_t m_RefObjNum; } m_StreamContent; struct { - FX_DWORD m_PageObjNum; + uint32_t m_PageObjNum; - FX_DWORD m_RefObjNum; + uint32_t m_RefObjNum; } m_Object; }; }; diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index 99d4dbd849..a674eb7290 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -51,10 +51,10 @@ class CFX_DIBAttribute { uint8_t m_strTime[20]; int32_t m_nGifLeft; int32_t m_nGifTop; - FX_DWORD* m_pGifLocalPalette; - FX_DWORD m_nGifLocalPalNum; + uint32_t* m_pGifLocalPalette; + uint32_t m_nGifLocalPalNum; int32_t m_nBmpCompressType; - std::map<FX_DWORD, void*> m_Exif; + std::map<uint32_t, void*> m_Exif; }; #endif // PDF_ENABLE_XFA @@ -97,15 +97,15 @@ class ICodec_BasicModule { public: virtual ~ICodec_BasicModule() {} virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; + uint32_t& dest_size) = 0; virtual FX_BOOL A85Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; + uint32_t& dest_size) = 0; virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -116,7 +116,7 @@ class ICodec_ScanlineDecoder { public: virtual ~ICodec_ScanlineDecoder() {} - virtual FX_DWORD GetSrcOffset() = 0; + virtual uint32_t GetSrcOffset() = 0; virtual void DownScale(int dest_width, int dest_height) = 0; @@ -141,7 +141,7 @@ class ICodec_FlateModule { public: virtual ~ICodec_FlateModule() {} virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, @@ -150,36 +150,36 @@ class ICodec_FlateModule { int Colors, int BitsPerComponent, int Columns) = 0; - virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, + virtual uint32_t FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, - FX_DWORD estimated_size, + uint32_t estimated_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; + uint32_t& dest_size) = 0; virtual FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; + uint32_t& dest_size) = 0; virtual FX_BOOL Encode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; + uint32_t& dest_size) = 0; }; class ICodec_FaxModule { public: virtual ~ICodec_FaxModule() {} virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int K, @@ -194,35 +194,35 @@ class ICodec_FaxModule { int height, int pitch, uint8_t*& dest_buf, - FX_DWORD& dest_size) = 0; + uint32_t& dest_size) = 0; }; class ICodec_JpegModule { public: virtual ~ICodec_JpegModule() {} virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int width, int height, int nComps, FX_BOOL ColorTransform) = 0; virtual FX_BOOL LoadInfo(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int& width, int& height, int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr = NULL, - FX_DWORD* icc_length = NULL) = 0; + uint32_t* icc_length = NULL) = 0; virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality = 75, const uint8_t* icc_buf = NULL, - FX_DWORD icc_length = 0) = 0; + uint32_t icc_length = 0) = 0; virtual void* Start() = 0; @@ -230,7 +230,7 @@ class ICodec_JpegModule { virtual void Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) = 0; + uint32_t src_size) = 0; #ifdef PDF_ENABLE_XFA virtual int ReadHeader(void* pContext, @@ -249,7 +249,7 @@ class ICodec_JpegModule { virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; - virtual FX_DWORD GetAvailInput(void* pContext, + virtual uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr = NULL) = 0; }; @@ -258,13 +258,13 @@ class ICodec_JpxModule { virtual ~ICodec_JpxModule() {} virtual CJPX_Decoder* CreateDecoder(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CPDF_ColorSpace* cs) = 0; virtual void GetImageInfo(CJPX_Decoder* pDecoder, - FX_DWORD* width, - FX_DWORD* height, - FX_DWORD* components) = 0; + uint32_t* width, + uint32_t* height, + uint32_t* components) = 0; virtual bool Decode(CJPX_Decoder* pDecoder, uint8_t* dest_data, @@ -284,7 +284,7 @@ class ICodec_PngModule { virtual FX_BOOL Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, CFX_DIBAttribute* pAttribute) = 0; FX_BOOL (*ReadHeaderCallback)(void* pModule, @@ -307,12 +307,12 @@ class ICodec_GifModule { virtual void Finish(void* pContext) = 0; - virtual FX_DWORD GetAvailInput(void* pContext, + virtual uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr = NULL) = 0; virtual void Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) = 0; + uint32_t src_size) = 0; virtual int32_t ReadHeader(void* pContext, int* width, @@ -324,7 +324,7 @@ class ICodec_GifModule { virtual int32_t LoadFrameInfo(void* pContext, int* frame_num) = 0; - void (*RecordCurrentPositionCallback)(void* pModule, FX_DWORD& cur_pos); + void (*RecordCurrentPositionCallback)(void* pModule, uint32_t& cur_pos); uint8_t* (*AskLocalPaletteBufCallback)(void* pModule, int32_t frame_num, @@ -335,7 +335,7 @@ class ICodec_GifModule { CFX_DIBAttribute* pAttribute) = 0; FX_BOOL (*InputRecordPositionBufCallback)(void* pModule, - FX_DWORD rcd_pos, + uint32_t rcd_pos, const FX_RECT& img_rc, int32_t pal_num, void* pal_ptr, @@ -357,12 +357,12 @@ class ICodec_BmpModule { virtual void Finish(void* pContext) = 0; - virtual FX_DWORD GetAvailInput(void* pContext, + virtual uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr = NULL) = 0; virtual void Input(void* pContext, const uint8_t* src_buf, - FX_DWORD src_size) = 0; + uint32_t src_size) = 0; virtual int32_t ReadHeader(void* pContext, int32_t* width, @@ -370,12 +370,12 @@ class ICodec_BmpModule { FX_BOOL* tb_flag, int32_t* components, int* pal_num, - FX_DWORD** pal_pp, + uint32_t** pal_pp, CFX_DIBAttribute* pAttribute) = 0; virtual int32_t LoadImage(void* pContext) = 0; - FX_BOOL (*InputImagePositionBufCallback)(void* pModule, FX_DWORD rcd_pos); + FX_BOOL (*InputImagePositionBufCallback)(void* pModule, uint32_t rcd_pos); void (*ReadScanlineCallback)(void* pModule, int32_t row_num, @@ -391,10 +391,10 @@ class ICodec_TiffModule { virtual FX_BOOL LoadFrameInfo(void* ctx, int32_t frame, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& comps, - FX_DWORD& bpc, + uint32_t& width, + uint32_t& height, + uint32_t& comps, + uint32_t& bpc, CFX_DIBAttribute* pAttribute) = 0; virtual FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) = 0; @@ -411,12 +411,12 @@ class ICodec_Jbig2Module { virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, CFX_PrivateData* pPrivateData, - FX_DWORD width, - FX_DWORD height, + uint32_t width, + uint32_t height, CPDF_StreamAcc* src_stream, CPDF_StreamAcc* global_stream, uint8_t* dest_buf, - FX_DWORD dest_pitch, + uint32_t dest_pitch, IFX_Pause* pPause) = 0; virtual FXCODEC_STATUS ContinueDecode(void* pJbig2Content, @@ -477,12 +477,12 @@ class ICodec_IccModule { }; struct IccParam { - FX_DWORD Version; + uint32_t Version; IccCS ColorSpace; - FX_DWORD dwProfileType; - FX_DWORD dwFormat; + uint32_t dwProfileType; + uint32_t dwFormat; uint8_t* pProfileData; - FX_DWORD dwProfileSize; + uint32_t dwProfileSize; double Gamma; }; @@ -497,27 +497,27 @@ class ICodec_IccModule { ICodec_IccModule::IccParam* pInputParam, ICodec_IccModule::IccParam* pOutputParam, ICodec_IccModule::IccParam* pProofParam = NULL, - FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, - FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, - FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, - FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING) = 0; + uint32_t dwIntent = Icc_INTENT_PERCEPTUAL, + uint32_t dwFlag = Icc_FLAGS_DEFAULT, + uint32_t dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, + uint32_t dwPrfFlag = Icc_FLAGS_SOFTPROOFING) = 0; virtual void* CreateTransform_sRGB( const uint8_t* pProfileData, - FX_DWORD dwProfileSize, - FX_DWORD& nComponents, + uint32_t dwProfileSize, + uint32_t& nComponents, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; virtual void* CreateTransform_CMYK( const uint8_t* pSrcProfileData, - FX_DWORD dwSrcProfileSize, - FX_DWORD& nSrcComponents, + uint32_t dwSrcProfileSize, + uint32_t& nSrcComponents, const uint8_t* pDstProfileData, - FX_DWORD dwDstProfileSize, + uint32_t dwDstProfileSize, int32_t intent = 0, - FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, - FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) = 0; + uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT, + uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) = 0; virtual void DestroyTransform(void* pTransform) = 0; @@ -529,7 +529,7 @@ class ICodec_IccModule { uint8_t* pDest, const uint8_t* pSrc, int pixels) = 0; - virtual void SetComponents(FX_DWORD nComponents) = 0; + virtual void SetComponents(uint32_t nComponents) = 0; }; void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels); @@ -554,9 +554,9 @@ void AdobeCMYK_to_sRGB1(uint8_t c, uint8_t& R, uint8_t& G, uint8_t& B); -FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]); +FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]); void FaxG4Decode(const uint8_t* src_buf, - FX_DWORD src_size, + uint32_t src_size, int* pbitpos, uint8_t* dest_buf, int width, diff --git a/core/include/fxge/fpf.h b/core/include/fxge/fpf.h index 6e596782cf..bc42a2dd95 100644 --- a/core/include/fxge/fpf.h +++ b/core/include/fxge/fpf.h @@ -31,7 +31,7 @@ class IFPF_Font { virtual FPF_HFONT GetHandle() = 0; virtual CFX_ByteString GetFamilyName() = 0; virtual CFX_WideString GetPsName() = 0; - virtual FX_DWORD GetFontStyle() const = 0; + virtual uint32_t GetFontStyle() const = 0; virtual uint8_t GetCharset() const = 0; virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode) = 0; @@ -45,9 +45,9 @@ class IFPF_Font { virtual int32_t GetHeight() const = 0; virtual int32_t GetItalicAngle() const = 0; - virtual FX_DWORD GetFontData(FX_DWORD dwTable, + virtual uint32_t GetFontData(uint32_t dwTable, uint8_t* pBuffer, - FX_DWORD dwSize) = 0; + uint32_t dwSize) = 0; protected: virtual ~IFPF_Font() {} @@ -63,8 +63,8 @@ class IFPF_FontMgr { virtual IFPF_Font* CreateFont(const CFX_ByteStringC& bsFamilyname, uint8_t charset, - FX_DWORD dwStyle, - FX_DWORD dwMatch = 0) = 0; + uint32_t dwStyle, + uint32_t dwMatch = 0) = 0; }; #endif // CORE_INCLUDE_FXGE_FPF_H_ diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h index bc8954486d..09081786ef 100644 --- a/core/include/fxge/fx_dib.h +++ b/core/include/fxge/fx_dib.h @@ -60,9 +60,9 @@ enum FXDIB_Channel { #define FXDIB_BLEND_COLOR 23 #define FXDIB_BLEND_LUMINOSITY 24 #define FXDIB_BLEND_UNSUPPORTED -1 -typedef FX_DWORD FX_ARGB; -typedef FX_DWORD FX_COLORREF; -typedef FX_DWORD FX_CMYK; +typedef uint32_t FX_ARGB; +typedef uint32_t FX_COLORREF; +typedef uint32_t FX_CMYK; class CFX_ClipRgn; class CFX_DIBSource; class CFX_DIBitmap; @@ -93,7 +93,7 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb); #define FXARGB_G(argb) ((uint8_t)((argb) >> 8)) #define FXARGB_B(argb) ((uint8_t)(argb)) #define FXARGB_MAKE(a, r, g, b) \ - (((FX_DWORD)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) + (((uint32_t)(a) << 24) | ((r) << 16) | ((g) << 8) | (b)) #define FXARGB_MUL_ALPHA(argb, alpha) \ (((((argb) >> 24) * (alpha) / 255) << 24) | ((argb)&0xffffff)) #define FXRGB2GRAY(r, g, b) (((b)*11 + (g)*59 + (r)*30) / 100) @@ -168,8 +168,8 @@ class CFX_DIBSource { FXDIB_Format GetFormat() const { return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp); } - FX_DWORD GetPitch() const { return m_Pitch; } - FX_DWORD* GetPalette() const { return m_pPalette; } + uint32_t GetPitch() const { return m_Pitch; } + uint32_t* GetPalette() const { return m_pPalette; } virtual uint8_t* GetBuffer() const; virtual const uint8_t* GetScanline(int line) const = 0; @@ -197,15 +197,15 @@ class CFX_DIBSource { return IsAlphaMask() ? 0 : (m_bpp == 1 ? 2 : (m_bpp == 8 ? 256 : 0)); } - FX_DWORD GetPaletteEntry(int index) const; + uint32_t GetPaletteEntry(int index) const; - void SetPaletteEntry(int index, FX_DWORD color); - FX_DWORD GetPaletteArgb(int index) const { return GetPaletteEntry(index); } - void SetPaletteArgb(int index, FX_DWORD color) { + void SetPaletteEntry(int index, uint32_t color); + uint32_t GetPaletteArgb(int index) const { return GetPaletteEntry(index); } + void SetPaletteArgb(int index, uint32_t color) { SetPaletteEntry(index, color); } - void CopyPalette(const FX_DWORD* pSrcPal, FX_DWORD size = 256); + void CopyPalette(const uint32_t* pSrcPal, uint32_t size = 256); CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const; CFX_DIBitmap* CloneConvert(FXDIB_Format format, @@ -214,12 +214,12 @@ class CFX_DIBSource { CFX_DIBitmap* StretchTo(int dest_width, int dest_height, - FX_DWORD flags = 0, + uint32_t flags = 0, const FX_RECT* pClip = NULL) const; CFX_DIBitmap* TransformTo(const CFX_Matrix* pMatrix, int& left, int& top, - FX_DWORD flags = 0, + uint32_t flags = 0, const FX_RECT* pClip = NULL) const; CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const; @@ -250,14 +250,14 @@ class CFX_DIBSource { int m_Width; int m_Height; int m_bpp; - FX_DWORD m_AlphaFlag; - FX_DWORD m_Pitch; - FX_DWORD* m_pPalette; + uint32_t m_AlphaFlag; + uint32_t m_Pitch; + uint32_t* m_pPalette; void BuildPalette(); FX_BOOL BuildAlphaMask(); - int FindPalette(FX_DWORD color) const; - void GetPalette(FX_DWORD* pal, int alpha) const; + int FindPalette(uint32_t color) const; + void GetPalette(uint32_t* pal, int alpha) const; }; class CFX_DIBitmap : public CFX_DIBSource { public: @@ -288,11 +288,11 @@ class CFX_DIBitmap : public CFX_DIBSource { FX_BOOL ConvertFormat(FXDIB_Format format, void* pIccTransform = NULL); - void Clear(FX_DWORD color); + void Clear(uint32_t color); - FX_DWORD GetPixel(int x, int y) const; + uint32_t GetPixel(int x, int y) const; - void SetPixel(int x, int y, FX_DWORD color); + void SetPixel(int x, int y, uint32_t color); FX_BOOL LoadChannel(FXDIB_Channel destChannel, const CFX_DIBSource* pSrcBitmap, @@ -330,7 +330,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int width, int height, const CFX_DIBSource* pMask, - FX_DWORD color, + uint32_t color, int src_left, int src_top, int alpha_flag = 0, @@ -341,7 +341,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int width, int height, const CFX_DIBSource* pMask, - FX_DWORD color, + uint32_t color, int src_left, int src_top, int blend_type = FXDIB_BLEND_NORMAL, @@ -354,13 +354,13 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL); - FX_BOOL ConvertColorScale(FX_DWORD forecolor, FX_DWORD backcolor); + FX_BOOL ConvertColorScale(uint32_t forecolor, uint32_t backcolor); - FX_BOOL DitherFS(const FX_DWORD* pPalette, + FX_BOOL DitherFS(const uint32_t* pPalette, int pal_size, const FX_RECT* pRect = NULL); @@ -393,7 +393,7 @@ class CFX_FilteredDIB : public CFX_DIBSource { virtual FXDIB_Format GetDestFormat() = 0; - virtual FX_DWORD* GetDestPalette() = 0; + virtual uint32_t* GetDestPalette() = 0; virtual void TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const = 0; @@ -432,7 +432,7 @@ class IFX_ScanlineComposer { virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_format, - FX_DWORD* pSrcPalette) = 0; + uint32_t* pSrcPalette) = 0; }; class CFX_ScanlineCompositor { public: @@ -443,8 +443,8 @@ class CFX_ScanlineCompositor { FX_BOOL Init(FXDIB_Format dest_format, FXDIB_Format src_format, int32_t width, - FX_DWORD* pSrcPalette, - FX_DWORD mask_color, + uint32_t* pSrcPalette, + uint32_t mask_color, int blend_type, FX_BOOL bClip, FX_BOOL bRgbByteOrder = FALSE, @@ -482,7 +482,7 @@ class CFX_ScanlineCompositor { protected: int m_Transparency; FXDIB_Format m_SrcFormat, m_DestFormat; - FX_DWORD* m_pSrcPalette; + uint32_t* m_pSrcPalette; int m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, m_MaskBlack; int m_BlendType; @@ -500,7 +500,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer { void Compose(CFX_DIBitmap* pDest, const CFX_ClipRgn* pClipRgn, int bitmap_alpha, - FX_DWORD mask_color, + uint32_t mask_color, FX_RECT& dest_rect, FX_BOOL bVertical, FX_BOOL bFlipX, @@ -514,7 +514,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer { FX_BOOL SetInfo(int width, int height, FXDIB_Format src_format, - FX_DWORD* pSrcPalette) override; + uint32_t* pSrcPalette) override; void ComposeScanline(int line, const uint8_t* scanline, @@ -531,7 +531,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer { const CFX_ClipRgn* m_pClipRgn; FXDIB_Format m_SrcFormat; int m_DestLeft, m_DestTop, m_DestWidth, m_DestHeight, m_BitmapAlpha; - FX_DWORD m_MaskColor; + uint32_t m_MaskColor; const CFX_DIBitmap* m_pClipMask; CFX_ScanlineCompositor m_Compositor; FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; @@ -561,7 +561,7 @@ class CFX_BitmapStorer : public IFX_ScanlineComposer { FX_BOOL SetInfo(int width, int height, FXDIB_Format src_format, - FX_DWORD* pSrcPalette) override; + uint32_t* pSrcPalette) override; CFX_DIBitmap* GetBitmap() { return m_pBitmap; } @@ -583,7 +583,7 @@ class CFX_ImageStretcher { int dest_width, int dest_height, const FX_RECT& bitmap_rect, - FX_DWORD flags); + uint32_t flags); FX_BOOL Continue(IFX_Pause* pPause); FX_BOOL StartQuickStretch(); @@ -594,7 +594,7 @@ class CFX_ImageStretcher { IFX_ScanlineComposer* m_pDest; const CFX_DIBSource* m_pSource; CStretchEngine* m_pStretchEngine; - FX_DWORD m_Flags; + uint32_t m_Flags; FX_BOOL m_bFlipX; FX_BOOL m_bFlipY; int m_DestWidth; @@ -627,7 +627,7 @@ class CFX_ImageTransformer { CFX_Matrix m_dest2stretch; CFX_ImageStretcher m_Stretcher; CFX_BitmapStorer m_Storer; - FX_DWORD m_Flags; + uint32_t m_Flags; int m_Status; }; class CFX_ImageRenderer { @@ -639,9 +639,9 @@ class CFX_ImageRenderer { const CFX_ClipRgn* pClipRgn, const CFX_DIBSource* pSource, int bitmap_alpha, - FX_DWORD mask_color, + uint32_t mask_color, const CFX_Matrix* pMatrix, - FX_DWORD dib_flags, + uint32_t dib_flags, FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL, @@ -653,14 +653,14 @@ class CFX_ImageRenderer { CFX_DIBitmap* m_pDevice; const CFX_ClipRgn* m_pClipRgn; int m_BitmapAlpha; - FX_DWORD m_MaskColor; + uint32_t m_MaskColor; CFX_Matrix m_Matrix; CFX_ImageTransformer* m_pTransformer; CFX_ImageStretcher m_Stretcher; CFX_BitmapComposer m_Composer; int m_Status; FX_RECT m_ClipBox; - FX_DWORD m_Flags; + uint32_t m_Flags; int m_AlphaFlag; void* m_pIccTransform; FX_BOOL m_bRgbByteOrder; diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h index 382a916734..c52e614e97 100644 --- a/core/include/fxge/fx_font.h +++ b/core/include/fxge/fx_font.h @@ -66,12 +66,12 @@ class CFX_Font { void LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, - FX_DWORD flags, + uint32_t flags, int weight, int italic_angle, int CharsetCP, FX_BOOL bVertical = FALSE); - FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size); + FX_BOOL LoadEmbedded(const uint8_t* data, uint32_t size); FXFT_Face GetFace() const { return m_Face; } #ifdef PDF_ENABLE_XFA @@ -87,11 +87,11 @@ class CFX_Font { const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } #endif // PDF_ENABLE_XFA - CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0); - int GetGlyphWidth(FX_DWORD glyph_index); + CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width = 0); + int GetGlyphWidth(uint32_t glyph_index); int GetAscent() const; int GetDescent() const; - FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox); + FX_BOOL GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox); FX_BOOL IsItalic() const; FX_BOOL IsBold() const; FX_BOOL IsFixedWidth() const; @@ -111,7 +111,7 @@ class CFX_Font { void* GetPlatformFont() const { return m_pPlatformFont; } void SetPlatformFont(void* font) { m_pPlatformFont = font; } uint8_t* GetFontData() const { return m_pFontData; } - FX_DWORD GetSize() const { return m_dwSize; } + uint32_t GetSize() const { return m_dwSize; } void AdjustMMParams(int glyph_index, int width, int weight); private: @@ -123,7 +123,7 @@ class CFX_Font { uint8_t* m_pFontDataAllocation; uint8_t* m_pFontData; uint8_t* m_pGsubData; - FX_DWORD m_dwSize; + uint32_t m_dwSize; CFX_BinaryBuf m_OtfFontData; void* m_hHandle; void* m_pPlatformFont; @@ -147,8 +147,8 @@ class CFX_Font { #ifdef PDF_ENABLE_XFA #define FXFM_ENC_TAG(a, b, c, d) \ - (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \ - (FX_DWORD)(d)) + (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | \ + (uint32_t)(d)) #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') @@ -170,7 +170,7 @@ class CFX_UnicodeEncoding { explicit CFX_UnicodeEncoding(CFX_Font* pFont); virtual ~CFX_UnicodeEncoding(); - virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode); + virtual uint32_t GlyphFromCharCode(uint32_t charcode); protected: // Unowned, not nullptr. @@ -180,20 +180,20 @@ class CFX_UnicodeEncoding { #ifdef PDF_ENABLE_XFA class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding { public: - CFX_UnicodeEncodingEx(CFX_Font* pFont, FX_DWORD EncodingID); + CFX_UnicodeEncodingEx(CFX_Font* pFont, uint32_t EncodingID); ~CFX_UnicodeEncodingEx() override; // CFX_UnicodeEncoding: - FX_DWORD GlyphFromCharCode(FX_DWORD charcode) override; + uint32_t GlyphFromCharCode(uint32_t charcode) override; - FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const; + uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; private: - FX_DWORD m_nEncodingID; + uint32_t m_nEncodingID; }; CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx( CFX_Font* pFont, - FX_DWORD nEncodingID = FXFM_ENCODING_NONE); + uint32_t nEncodingID = FXFM_ENCODING_NONE); #endif // PDF_ENABLE_XFA #define FXFONT_SUBST_MM 0x01 @@ -214,7 +214,7 @@ class CFX_SubstFont { int m_Charset; - FX_DWORD m_SubstFlags; + uint32_t m_SubstFlags; int m_Weight; @@ -249,29 +249,29 @@ class CFX_FontMgr { int weight, FX_BOOL bItalic, uint8_t* pData, - FX_DWORD size, + uint32_t size, int face_index); FXFT_Face GetCachedTTCFace(int ttc_size, - FX_DWORD checksum, + uint32_t checksum, int font_offset, uint8_t*& pFontData); FXFT_Face AddCachedTTCFace(int ttc_size, - FX_DWORD checksum, + uint32_t checksum, uint8_t* pData, - FX_DWORD size, + uint32_t size, int font_offset); FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index); - FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int face_index); + FXFT_Face GetFixedFace(const uint8_t* pData, uint32_t size, int face_index); void ReleaseFace(FXFT_Face face); void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo); FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, - FX_DWORD flags, + uint32_t flags, int weight, int italic_angle, int CharsetCP, CFX_SubstFont* pSubstFont); - bool GetBuiltinFont(size_t index, const uint8_t** pFontData, FX_DWORD* size); + bool GetBuiltinFont(size_t index, const uint8_t** pFontData, uint32_t* size); CFX_FontMapper* GetBuiltinMapper() const { return m_pBuiltinMapper.get(); } FXFT_Library GetFTLibrary() const { return m_FTLibrary; } @@ -316,14 +316,14 @@ class CFX_FontMapper { IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; } FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL bTrueType, - FX_DWORD flags, + uint32_t flags, int weight, int italic_angle, int CharsetCP, CFX_SubstFont* pSubstFont); #ifdef PDF_ENABLE_XFA - FXFT_Face FindSubstFontByUnicode(FX_DWORD dwUnicode, - FX_DWORD flags, + FXFT_Face FindSubstFontByUnicode(uint32_t dwUnicode, + uint32_t flags, int weight, int italic_angle); #endif // PDF_ENABLE_XFA @@ -346,7 +346,7 @@ class CFX_FontMapper { FX_BOOL m_bListLoaded; FXFT_Face m_MMFaces[MM_FACE_COUNT]; CFX_ByteString m_LastFamily; - CFX_ArrayTemplate<FX_DWORD> m_CharsetArray; + CFX_ArrayTemplate<uint32_t> m_CharsetArray; std::vector<CFX_ByteString> m_FaceArray; IFX_SystemFontInfo* m_pFontInfo; FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT]; @@ -368,17 +368,17 @@ class IFX_SystemFontInfo { int& iExact) = 0; #ifdef PDF_ENABLE_XFA - virtual void* MapFontByUnicode(FX_DWORD dwUnicode, + virtual void* MapFontByUnicode(uint32_t dwUnicode, int weight, FX_BOOL bItalic, int pitch_family); #endif // PDF_ENABLE_XFA virtual void* GetFont(const FX_CHAR* face) = 0; - virtual FX_DWORD GetFontData(void* hFont, - FX_DWORD table, + virtual uint32_t GetFontData(void* hFont, + uint32_t table, uint8_t* buffer, - FX_DWORD size) = 0; + uint32_t size) = 0; virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; virtual int GetFaceIndex(void* hFont); @@ -405,16 +405,16 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { const FX_CHAR* face, int& bExact) override; #ifdef PDF_ENABLE_XFA - void* MapFontByUnicode(FX_DWORD dwUnicode, + void* MapFontByUnicode(uint32_t dwUnicode, int weight, FX_BOOL bItalic, int pitch_family) override; #endif // PDF_ENABLE_XFA void* GetFont(const FX_CHAR* face) override; - FX_DWORD GetFontData(void* hFont, - FX_DWORD table, + uint32_t GetFontData(void* hFont, + uint32_t table, uint8_t* buffer, - FX_DWORD size) override; + uint32_t size) override; void DeleteFont(void* hFont) override; FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; FX_BOOL GetFontCharset(void* hFont, int& charset) override; @@ -424,8 +424,8 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { void ScanFile(const CFX_ByteString& path); void ReportFace(const CFX_ByteString& path, FXSYS_FILE* pFile, - FX_DWORD filesize, - FX_DWORD offset); + uint32_t filesize, + uint32_t offset); void* GetSubstFont(const CFX_ByteString& face); void* FindFont(int weight, FX_BOOL bItalic, @@ -442,7 +442,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo { class CFX_CountedFaceCache { public: CFX_FaceCache* m_Obj; - FX_DWORD m_nCount; + uint32_t m_nCount; }; class CFX_FontCache { @@ -480,32 +480,32 @@ class CFX_FaceCache { explicit CFX_FaceCache(FXFT_Face face); ~CFX_FaceCache(); const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, FX_BOOL bFontStyle, const CFX_Matrix* pMatrix, int dest_width, int anti_alias, int& text_flags); const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, int dest_width); private: CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, FX_BOOL bFontStyle, const CFX_Matrix* pMatrix, int dest_width, int anti_alias); CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, - FX_DWORD glyph_index, + uint32_t glyph_index, const CFX_Matrix* pMatrix, int dest_width, int anti_alias); CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Matrix* pMatrix, CFX_ByteStringC& FaceGlyphsKey, - FX_DWORD glyph_index, + uint32_t glyph_index, FX_BOOL bFontStyle, int dest_width, int anti_alias); @@ -514,7 +514,7 @@ class CFX_FaceCache { FXFT_Face const m_Face; std::map<CFX_ByteString, CFX_SizeGlyphCache*> m_SizeMap; - std::map<FX_DWORD, CFX_PathData*> m_PathMap; + std::map<uint32_t, CFX_PathData*> m_PathMap; CFX_DIBitmap* m_pBitmap; }; @@ -535,15 +535,15 @@ FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, class IFX_GSUBTable { public: static IFX_GSUBTable* Create(CFX_Font* pFont); - virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; + virtual FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) = 0; protected: virtual ~IFX_GSUBTable() {} }; CFX_ByteString GetNameFromTT(const uint8_t* name_table, - FX_DWORD name_table_size, - FX_DWORD name); + uint32_t name_table_size, + uint32_t name); int PDF_GetStandardFontName(CFX_ByteString* name); diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h index d824d08228..3eb9303a80 100644 --- a/core/include/fxge/fx_ge.h +++ b/core/include/fxge/fx_ge.h @@ -235,12 +235,12 @@ class CFX_GraphStateData { #define FXTEXT_PRINTIMAGETEXT 0x10 #define FXTEXT_NOSMOOTH 0x20 typedef struct { - FX_DWORD m_GlyphIndex; + uint32_t m_GlyphIndex; FX_FLOAT m_OriginX, m_OriginY; int m_FontCharWidth; FX_BOOL m_bGlyphAdjust; FX_FLOAT m_AdjustMatrix[4]; - FX_DWORD m_ExtGID; + uint32_t m_ExtGID; FX_BOOL m_bFontStyle; } FXTEXT_CHARPOS; @@ -286,8 +286,8 @@ class CFX_RenderDevice { FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag = 0, void* pIccTransform = NULL, @@ -295,12 +295,12 @@ class CFX_RenderDevice { FX_BOOL SetPixel(int x, int y, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL); FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); @@ -309,7 +309,7 @@ class CFX_RenderDevice { FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int fill_mode = 0, int alpha_flag = 0, void* pIccTransform = NULL, @@ -333,14 +333,14 @@ class CFX_RenderDevice { int top, int dest_width, int dest_height, - FX_DWORD flags = 0, + uint32_t flags = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL); FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap, int left, int top, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL); @@ -349,16 +349,16 @@ class CFX_RenderDevice { int top, int dest_width, int dest_height, - FX_DWORD color, - FX_DWORD flags = 0, + uint32_t color, + uint32_t flags = 0, int alpha_flag = 0, void* pIccTransform = NULL); FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, @@ -374,8 +374,8 @@ class CFX_RenderDevice { CFX_FontCache* pCache, FX_FLOAT font_size, const CFX_Matrix* pText2Device, - FX_DWORD fill_color, - FX_DWORD text_flags, + uint32_t fill_color, + uint32_t text_flags, int alpha_flag = 0, void* pIccTransform = NULL); @@ -387,8 +387,8 @@ class CFX_RenderDevice { const CFX_Matrix* pText2User, const CFX_Matrix* pUser2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, CFX_PathData* pClippingPath, int nFlag = 0, int alpha_flag = 0, @@ -403,8 +403,8 @@ class CFX_RenderDevice { FX_BOOL DrawFillStrokePath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag, void* pIccTransform, @@ -505,8 +505,8 @@ class IFX_RenderDeviceDriver { virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag = 0, void* pIccTransform = NULL, @@ -514,14 +514,14 @@ class IFX_RenderDeviceDriver { virtual FX_BOOL SetPixel(int x, int y, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL) { return FALSE; } virtual FX_BOOL FillRect(const FX_RECT* pRect, - FX_DWORD fill_color, + uint32_t fill_color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) { @@ -532,7 +532,7 @@ class IFX_RenderDeviceDriver { FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) { @@ -551,7 +551,7 @@ class IFX_RenderDeviceDriver { virtual CFX_DIBitmap* GetBackDrop() { return NULL; } virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const FX_RECT* pSrcRect, int dest_left, int dest_top, @@ -560,22 +560,22 @@ class IFX_RenderDeviceDriver { void* pIccTransform = NULL) = 0; virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT* pClipRect, - FX_DWORD flags, + uint32_t flags, int alpha_flag = 0, void* pIccTransform = NULL, int blend_type = FXDIB_BLEND_NORMAL) = 0; virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alpha, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, void*& handle, int alpha_flag = 0, void* pIccTransform = NULL, @@ -593,7 +593,7 @@ class IFX_RenderDeviceDriver { CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL) { return FALSE; @@ -652,33 +652,33 @@ class CFX_PSRenderer { FX_BOOL DrawPath(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, const CFX_GraphStateData* pGraphState, - FX_DWORD fill_color, - FX_DWORD stroke_color, + uint32_t fill_color, + uint32_t stroke_color, int fill_mode, int alpha_flag = 0, void* pIccTransform = NULL); FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int alpha_flag = 0, void* pIccTransform = NULL); FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, - FX_DWORD flags, + uint32_t flags, int alpha_flag = 0, void* pIccTransform = NULL); FX_BOOL DrawDIBits(const CFX_DIBSource* pBitmap, - FX_DWORD color, + uint32_t color, const CFX_Matrix* pMatrix, - FX_DWORD flags, + uint32_t flags, int alpha_flag = 0, void* pIccTransform = NULL); @@ -688,7 +688,7 @@ class CFX_PSRenderer { CFX_FontCache* pCache, const CFX_Matrix* pObject2Device, FX_FLOAT font_size, - FX_DWORD color, + uint32_t color, int alpha_flag = 0, void* pIccTransform = NULL); @@ -705,7 +705,7 @@ class CFX_PSRenderer { FX_BOOL m_bColorSet; - FX_DWORD m_LastColor; + uint32_t m_LastColor; FX_RECT m_ClipBox; @@ -719,7 +719,7 @@ class CFX_PSRenderer { void SetGraphState(const CFX_GraphStateData* pGraphState); - void SetColor(FX_DWORD color, int alpha_flag, void* pIccTransform); + void SetColor(uint32_t color, int alpha_flag, void* pIccTransform); void FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, diff --git a/core/include/fxge/fx_ge_win32.h b/core/include/fxge/fx_ge_win32.h index 149c46d40b..f1864590c5 100644 --- a/core/include/fxge/fx_ge_win32.h +++ b/core/include/fxge/fx_ge_win32.h @@ -32,8 +32,8 @@ class CFX_WindowsDIB : public CFX_DIBitmap { static CFX_DIBitmap* LoadFromDDB(HDC hDC, HBITMAP hBitmap, - FX_DWORD* pPalette = NULL, - FX_DWORD size = 256); + uint32_t* pPalette = NULL, + uint32_t size = 256); static CFX_DIBitmap* LoadFromFile(const FX_WCHAR* filename); |