summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-09 13:24:12 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-09 13:24:12 -0700
commitbfa9a824a20f37c2dd7111012b46c929cf2ed8a0 (patch)
tree4cfbe682869d89900f33751c37f6a84865beeb0a /core/src/fpdfapi/fpdf_parser
parentb116136da234afcad018bb44a3ccb64b9ad2a554 (diff)
downloadpdfium-bfa9a824a20f37c2dd7111012b46c929cf2ed8a0.tar.xz
Merge to XFA: Use stdint.h types throughout PDFium.
Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/filters_int.h8
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp34
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp166
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp64
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp40
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp318
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp6
8 files changed, 319 insertions, 319 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h
index 1139371fda..6652cc0ccc 100644
--- a/core/src/fpdfapi/fpdf_parser/filters_int.h
+++ b/core/src/fpdfapi/fpdf_parser/filters_int.h
@@ -26,7 +26,7 @@ public:
virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
void* m_pContext;
- FX_BYTE m_DestBuffer[FPDF_FILTER_BUFFER_SIZE];
+ uint8_t m_DestBuffer[FPDF_FILTER_BUFFER_SIZE];
};
class CPDF_LzwFilter : public CFX_DataFilter
{
@@ -40,11 +40,11 @@ public:
FX_DWORD m_nCodes;
FX_DWORD m_CodeLen;
FX_DWORD m_OldCode;
- FX_BYTE m_LastChar;
+ uint8_t m_LastChar;
FX_DWORD m_nLeftBits, m_LeftBits;
- FX_BYTE m_DecodeStack[4000];
+ uint8_t m_DecodeStack[4000];
FX_DWORD m_StackLen;
- void AddCode(FX_DWORD prefix_code, FX_BYTE append_char);
+ void AddCode(FX_DWORD prefix_code, uint8_t append_char);
void DecodeString(FX_DWORD code);
};
class CPDF_PredictorFilter : public CFX_DataFilter
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index d18caab217..b1fde0be71 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -9,7 +9,7 @@
#include "../../../include/fxcodec/fx_codec.h"
#include <limits.h>
#define _STREAM_MAX_SIZE_ 20 * 1024 * 1024
-FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
dest_size = 0;
dest_buf = NULL;
@@ -19,7 +19,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
FX_DWORD zcount = 0;
FX_DWORD pos = 0;
while (pos < src_size) {
- FX_BYTE ch = src_buf[pos];
+ uint8_t ch = src_buf[pos];
if (ch < '!' && ch != '\n' && ch != '\r' && ch != ' ' && ch != '\t') {
break;
}
@@ -39,12 +39,12 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
if (zcount * 4 > UINT_MAX - (pos - zcount)) {
return (FX_DWORD) - 1;
}
- dest_buf = FX_Alloc(FX_BYTE, zcount * 4 + (pos - zcount));
+ dest_buf = FX_Alloc(uint8_t, zcount * 4 + (pos - zcount));
int state = 0;
- FX_UINT32 res = 0;
+ uint32_t res = 0;
pos = dest_size = 0;
while (pos < src_size) {
- FX_BYTE ch = src_buf[pos++];
+ uint8_t ch = src_buf[pos++];
if (ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t') {
continue;
}
@@ -61,7 +61,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
state ++;
if (state == 5) {
for (int i = 0; i < 4; i ++) {
- dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8);
+ dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8);
}
state = 0;
res = 0;
@@ -74,7 +74,7 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
res = res * 85 + 84;
}
for (i = 0; i < state - 1; i ++) {
- dest_buf[dest_size++] = (FX_BYTE)(res >> (3 - i) * 8);
+ dest_buf[dest_size++] = (uint8_t)(res >> (3 - i) * 8);
}
}
if (pos < src_size && src_buf[pos] == '>') {
@@ -82,18 +82,18 @@ FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
}
return pos;
}
-FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
FX_DWORD i;
for (i = 0; i < src_size; i ++)
if (src_buf[i] == '>') {
break;
}
- dest_buf = FX_Alloc( FX_BYTE, i / 2 + 1);
+ dest_buf = FX_Alloc( uint8_t, i / 2 + 1);
dest_size = 0;
FX_BOOL bFirstDigit = TRUE;
for (i = 0; i < src_size; i ++) {
- FX_BYTE ch = src_buf[i];
+ uint8_t ch = src_buf[i];
if (ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r') {
continue;
}
@@ -122,7 +122,7 @@ FX_DWORD _HexDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
}
return i;
}
-FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
FX_DWORD i = 0;
FX_DWORD old;
@@ -149,7 +149,7 @@ FX_DWORD RunLengthDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& d
if (dest_size >= _STREAM_MAX_SIZE_) {
return -1;
}
- dest_buf = FX_Alloc( FX_BYTE, dest_size);
+ dest_buf = FX_Alloc( uint8_t, dest_size);
i = 0;
int dest_count = 0;
while (i < src_size) {
@@ -245,7 +245,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD
return CPDF_ModuleMgr::Get()->GetFlateModule()->CreateDecoder(src_buf, src_size, width, height,
nComps, bpc, predictor, Colors, BitsPerComponent, Columns);
}
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
+FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
int predictor = 0;
@@ -468,7 +468,7 @@ CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap
dest_buf2 += 2;
for (int i = 0; i < len; i ++) {
*dest_buf2++ = pString[i] >> 8;
- *dest_buf2++ = (FX_BYTE)pString[i];
+ *dest_buf2++ = (uint8_t)pString[i];
}
result.ReleaseBuffer(encLen);
return result;
@@ -488,7 +488,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex)
}
result.AppendChar('(');
for (int i = 0; i < srclen; i ++) {
- FX_BYTE ch = src[i];
+ uint8_t ch = src[i];
if (ch == ')' || ch == '\\' || ch == '(') {
result.AppendChar('\\');
} else if (ch == 0x0a) {
@@ -503,7 +503,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex)
result.AppendChar(')');
return result.GetByteString();
}
-void FlateEncode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
@@ -518,7 +518,7 @@ void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Color
pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, BitsPerComponent, Columns, dest_buf, dest_size);
}
}
-FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index b11c7eeb44..f2643694ec 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -343,7 +343,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const
{
{
CPDF_Object* pObj;
- if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pObj)) {
+ if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj)) {
bForm = pObj->GetType() == PDFOBJ_STREAM &&
((CPDF_Stream*)pObj)->GetDict()->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Form");
return TRUE;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index e35b0a9d10..4ca97fe9e8 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -7,7 +7,7 @@
#include <time.h>
#include "../../../include/fpdfapi/fpdf_parser.h"
#include "../../../include/fdrm/fx_crypt.h"
-const FX_BYTE defpasscode[32] = {
+const uint8_t defpasscode[32] = {
0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08,
0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80,
@@ -17,11 +17,11 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas
FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray)
{
int revision = pEncrypt->GetInteger(FX_BSTRC("R"));
- FX_BYTE passcode[32];
+ uint8_t passcode[32];
for (FX_DWORD i = 0; i < 32; i ++) {
passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size];
}
- FX_BYTE md5[100];
+ uint8_t md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, passcode, 32);
CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O"));
@@ -36,7 +36,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas
FX_DWORD tag = (FX_DWORD) - 1;
CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4);
}
- FX_BYTE digest[16];
+ uint8_t digest[16];
CRYPT_MD5Finish(md5, digest);
FX_DWORD copy_len = keylen;
if (copy_len > sizeof(digest)) {
@@ -55,8 +55,8 @@ CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler()
return new CPDF_StandardCryptoHandler;
}
typedef struct _PDF_CRYPTOITEM {
- FX_INT32 m_Cipher;
- FX_INT32 m_KeyLen;
+ int32_t m_Cipher;
+ int32_t m_KeyLen;
FX_BOOL m_bChecked;
CPDF_StandardCryptoHandler* m_pCryptoHandler;
} PDF_CRYPTOITEM;
@@ -85,7 +85,7 @@ FX_BOOL CPDF_StandardSecurityHandler::OnInit(CPDF_Parser* pParser, CPDF_Dictiona
}
return CheckSecurity(m_KeyLen);
}
-FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(FX_INT32 key_len)
+FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len)
{
CFX_ByteString password = m_pParser->GetPassword();
if (CheckPassword(password, password.GetLength(), TRUE, m_EncryptKey, key_len)) {
@@ -198,14 +198,14 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buff
}
#define FX_GET_32WORD(n,b,i) \
{ \
- (n) = (FX_DWORD)(( (FX_UINT64) (b)[(i)] << 24 ) \
- | ( (FX_UINT64) (b)[(i) + 1] << 16 ) \
- | ( (FX_UINT64) (b)[(i) + 2] << 8 ) \
- | ( (FX_UINT64) (b)[(i) + 3] )); \
+ (n) = (FX_DWORD)(( (uint64_t) (b)[(i)] << 24 ) \
+ | ( (uint64_t) (b)[(i) + 1] << 16 ) \
+ | ( (uint64_t) (b)[(i) + 2] << 8 ) \
+ | ( (uint64_t) (b)[(i) + 3] )); \
}
int BigOrder64BitsMod3(FX_LPBYTE data)
{
- FX_UINT64 ret = 0;
+ uint64_t ret = 0;
for (int i = 0; i < 4; ++i) {
FX_DWORD value;
FX_GET_32WORD(value, data, 4 * i);
@@ -218,14 +218,14 @@ int BigOrder64BitsMod3(FX_LPBYTE data)
void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCBYTE vector, FX_LPBYTE hash)
{
int iBlockSize = 32;
- FX_BYTE sha[128];
+ uint8_t sha[128];
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
CRYPT_SHA256Update(sha, salt, 8);
if (vector) {
CRYPT_SHA256Update(sha, vector, 48);
}
- FX_BYTE digest[32];
+ uint8_t digest[32];
CRYPT_SHA256Finish(sha, digest);
CFX_ByteTextBuf buf;
FX_LPBYTE input = digest;
@@ -235,7 +235,7 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB
int iBufLen = buf.GetLength();
CFX_ByteTextBuf interDigest;
int i = 0;
- FX_LPBYTE aes = FX_Alloc(FX_BYTE, 2048);
+ FX_LPBYTE aes = FX_Alloc(uint8_t, 2048);
while (i < 64 || i < E[iBufLen - 1] + 32) {
int iRoundSize = size + iBlockSize;
if (vector) {
@@ -300,8 +300,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password,
return FALSE;
}
FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey;
- FX_BYTE sha[128];
- FX_BYTE digest[32];
+ uint8_t sha[128];
+ uint8_t digest[32];
if (m_Revision >= 6) {
Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 32, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest);
} else {
@@ -334,9 +334,9 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password,
if (ekey.GetLength() < 32) {
return FALSE;
}
- FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048);
+ uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, digest, 32, FALSE);
- FX_BYTE iv[16];
+ uint8_t iv[16];
FXSYS_memset32(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESDecrypt(aes, key, ekey, 32);
@@ -346,14 +346,14 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password,
if (perms.IsEmpty()) {
return FALSE;
}
- FX_BYTE perms_buf[16];
+ uint8_t perms_buf[16];
FXSYS_memset32(perms_buf, 0, sizeof(perms_buf));
FX_DWORD copy_len = sizeof(perms_buf);
if (copy_len > (FX_DWORD)perms.GetLength()) {
copy_len = perms.GetLength();
}
FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len);
- FX_BYTE buf[16];
+ uint8_t buf[16];
CRYPT_AESDecrypt(aes, buf, perms_buf, 16);
FX_Free(aes);
if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') {
@@ -371,12 +371,12 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD pa
{
return CheckPassword(password, pass_size, bOwner, key, m_KeyLen);
}
-int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, FX_INT32 key_len)
+int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, int32_t key_len)
{
if (m_Revision >= 5) {
return AES256_CheckPassword(password, size, bOwner, key);
}
- FX_BYTE keybuf[32];
+ uint8_t keybuf[32];
if (key == NULL) {
key = keybuf;
}
@@ -386,7 +386,7 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD si
return CheckUserPassword(password, size, FALSE, key, key_len) || CheckUserPassword(password, size, TRUE, key, key_len);
}
FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_DWORD pass_size,
- FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, FX_INT32 key_len)
+ FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len)
{
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta,
m_pParser->GetIDArray());
@@ -394,12 +394,12 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_
if (ukey.GetLength() < 16) {
return FALSE;
}
- FX_BYTE ukeybuf[32];
+ uint8_t ukeybuf[32];
if (m_Revision == 2) {
FXSYS_memcpy32(ukeybuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len);
} else {
- FX_BYTE test[32], tmpkey[32];
+ uint8_t test[32], tmpkey[32];
FX_DWORD copy_len = sizeof(test);
if (copy_len > (FX_DWORD)ukey.GetLength()) {
copy_len = ukey.GetLength();
@@ -413,7 +413,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_
}
CRYPT_ArcFourCryptBlock(test, 32, tmpkey, key_len);
}
- FX_BYTE md5[100];
+ uint8_t md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, defpasscode, 32);
CPDF_Array* pIdArray = m_pParser->GetIDArray();
@@ -433,22 +433,22 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa
{
return GetUserPassword(owner_pass, pass_size, m_KeyLen);
}
-CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, FX_INT32 key_len)
+CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len)
{
CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O"));
- FX_BYTE passcode[32];
+ uint8_t passcode[32];
FX_DWORD i;
for (i = 0; i < 32; i ++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
}
- FX_BYTE digest[16];
+ uint8_t digest[16];
CRYPT_MD5Generate(passcode, 32, digest);
if (m_Revision >= 3) {
for (int i = 0; i < 50; i ++) {
CRYPT_MD5Generate(digest, 16, digest);
}
}
- FX_BYTE enckey[32];
+ uint8_t enckey[32];
FXSYS_memset32(enckey, 0, sizeof(enckey));
FX_DWORD copy_len = key_len;
if (copy_len > sizeof(digest)) {
@@ -459,14 +459,14 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa
if (okeylen > 32) {
okeylen = 32;
}
- FX_BYTE okeybuf[64];
+ uint8_t okeybuf[64];
FXSYS_memset32(okeybuf, 0, sizeof(okeybuf));
FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen);
if (m_Revision == 2) {
CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len);
} else {
for (int i = 19; i >= 0; i --) {
- FX_BYTE tempkey[32];
+ uint8_t tempkey[32];
FXSYS_memset32(tempkey, 0, sizeof(tempkey));
for (int j = 0; j < m_KeyLen; j ++) {
tempkey[j] = enckey[j] ^ i;
@@ -481,7 +481,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa
return CFX_ByteString(okeybuf, len);
}
FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size,
- FX_LPBYTE key, FX_INT32 key_len)
+ FX_LPBYTE key, int32_t key_len)
{
CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
if (CheckUserPassword(user_pass, user_pass.GetLength(), FALSE, key, key_len)) {
@@ -511,11 +511,11 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
}
if (m_Revision >= 5) {
int t = (int)time(NULL);
- FX_BYTE sha[128];
+ uint8_t sha[128];
CRYPT_SHA256Start(sha);
- CRYPT_SHA256Update(sha, (FX_BYTE*)&t, sizeof t);
+ CRYPT_SHA256Update(sha, (uint8_t*)&t, sizeof t);
CRYPT_SHA256Update(sha, m_EncryptKey, 32);
- CRYPT_SHA256Update(sha, (FX_BYTE*)"there", 5);
+ CRYPT_SHA256Update(sha, (uint8_t*)"there", 5);
CRYPT_SHA256Finish(sha, m_EncryptKey);
AES256_SetPassword(pEncryptDict, user_pass, user_size, FALSE, m_EncryptKey);
if (bDefault) {
@@ -525,29 +525,29 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
return;
}
if (bDefault) {
- FX_BYTE passcode[32];
+ uint8_t passcode[32];
FX_DWORD i;
for (i = 0; i < 32; i ++) {
passcode[i] = i < owner_size ? owner_pass[i] : defpasscode[i - owner_size];
}
- FX_BYTE digest[16];
+ uint8_t digest[16];
CRYPT_MD5Generate(passcode, 32, digest);
if (m_Revision >= 3) {
for (int i = 0; i < 50; i ++) {
CRYPT_MD5Generate(digest, 16, digest);
}
}
- FX_BYTE enckey[32];
+ uint8_t enckey[32];
FXSYS_memcpy32(enckey, digest, key_len);
for (i = 0; i < 32; i ++) {
passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size];
}
CRYPT_ArcFourCryptBlock(passcode, 32, enckey, key_len);
- FX_BYTE tempkey[32];
+ uint8_t tempkey[32];
if (m_Revision >= 3) {
for (i = 1; i <= 19; i ++) {
for (int j = 0; j < key_len; j ++) {
- tempkey[j] = enckey[j] ^ (FX_BYTE)i;
+ tempkey[j] = enckey[j] ^ (uint8_t)i;
}
CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len);
}
@@ -556,25 +556,25 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
}
CalcEncryptKey(m_pEncryptDict, (FX_LPBYTE)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray);
if (m_Revision < 3) {
- FX_BYTE tempbuf[32];
+ uint8_t tempbuf[32];
FXSYS_memcpy32(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
pEncryptDict->SetAtString(FX_BSTRC("U"), CFX_ByteString(tempbuf, 32));
} else {
- FX_BYTE md5[100];
+ uint8_t md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, defpasscode, 32);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetString(0);
CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength());
}
- FX_BYTE digest[32];
+ uint8_t digest[32];
CRYPT_MD5Finish(md5, digest);
CRYPT_ArcFourCryptBlock(digest, 16, m_EncryptKey, key_len);
- FX_BYTE tempkey[32];
+ uint8_t tempkey[32];
for (int i = 1; i <= 19; i ++) {
for (int j = 0; j < key_len; j ++) {
- tempkey[j] = m_EncryptKey[j] ^ (FX_BYTE)i;
+ tempkey[j] = m_EncryptKey[j] ^ (uint8_t)i;
}
CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len);
}
@@ -594,14 +594,14 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
}
void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key)
{
- FX_BYTE sha[128];
+ uint8_t sha[128];
CRYPT_SHA1Start(sha);
CRYPT_SHA1Update(sha, key, 32);
- CRYPT_SHA1Update(sha, (FX_BYTE*)"hello", 5);
- FX_BYTE digest[20];
+ CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5);
+ uint8_t digest[20];
CRYPT_SHA1Finish(sha, digest);
CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U"));
- FX_BYTE digest1[48];
+ uint8_t digest1[48];
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1);
} else {
@@ -626,9 +626,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
}
CRYPT_SHA256Finish(sha, digest1);
}
- FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048);
+ uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE);
- FX_BYTE iv[16];
+ uint8_t iv[16];
FXSYS_memset32(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, digest1, key, 32);
@@ -638,11 +638,11 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions,
FX_BOOL bEncryptMetadata, FX_LPCBYTE key)
{
- FX_BYTE buf[16];
- buf[0] = (FX_BYTE)permissions;
- buf[1] = (FX_BYTE)(permissions >> 8);
- buf[2] = (FX_BYTE)(permissions >> 16);
- buf[3] = (FX_BYTE)(permissions >> 24);
+ uint8_t buf[16];
+ buf[0] = (uint8_t)permissions;
+ buf[1] = (uint8_t)(permissions >> 8);
+ buf[2] = (uint8_t)(permissions >> 16);
+ buf[3] = (uint8_t)(permissions >> 24);
buf[4] = 0xff;
buf[5] = 0xff;
buf[6] = 0xff;
@@ -651,9 +651,9 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict
buf[9] = 'a';
buf[10] = 'd';
buf[11] = 'b';
- FX_BYTE* aes = FX_Alloc(FX_BYTE, 2048);
+ uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, key, 32, TRUE);
- FX_BYTE iv[16], buf1[16];
+ uint8_t iv[16], buf1[16];
FXSYS_memset32(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, buf1, buf, 16);
@@ -667,16 +667,16 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F
FXSYS_memcpy32(dest_buf, src_buf, src_size);
return;
}
- FX_BYTE realkey[16];
+ uint8_t realkey[16];
int realkeylen = 16;
if (m_Cipher != FXCIPHER_AES || m_KeyLen != 32) {
- FX_BYTE key1[32];
+ uint8_t key1[32];
FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen);
- key1[m_KeyLen + 0] = (FX_BYTE)objnum;
- key1[m_KeyLen + 1] = (FX_BYTE)(objnum >> 8);
- key1[m_KeyLen + 2] = (FX_BYTE)(objnum >> 16);
- key1[m_KeyLen + 3] = (FX_BYTE)gennum;
- key1[m_KeyLen + 4] = (FX_BYTE)(gennum >> 8);
+ key1[m_KeyLen + 0] = (uint8_t)objnum;
+ key1[m_KeyLen + 1] = (uint8_t)(objnum >> 8);
+ key1[m_KeyLen + 2] = (uint8_t)(objnum >> 16);
+ key1[m_KeyLen + 3] = (uint8_t)gennum;
+ key1[m_KeyLen + 4] = (uint8_t)(gennum >> 8);
FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3);
FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2);
if (m_Cipher == FXCIPHER_AES) {
@@ -691,15 +691,15 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F
if (m_Cipher == FXCIPHER_AES) {
CRYPT_AESSetKey(m_pAESContext, 16, m_KeyLen == 32 ? m_EncryptKey : realkey, m_KeyLen, bEncrypt);
if (bEncrypt) {
- FX_BYTE iv[16];
+ uint8_t iv[16];
for (int i = 0; i < 16; i ++) {
- iv[i] = (FX_BYTE)rand();
+ iv[i] = (uint8_t)rand();
}
CRYPT_AESSetIV(m_pAESContext, iv);
FXSYS_memcpy32(dest_buf, iv, 16);
int nblocks = src_size / 16;
CRYPT_AESEncrypt(m_pAESContext, dest_buf + 16, src_buf, nblocks * 16);
- FX_BYTE padding[16];
+ uint8_t padding[16];
FXSYS_memcpy32(padding, src_buf + nblocks * 16, src_size % 16);
FXSYS_memset8(padding + src_size % 16, 16 - src_size % 16, 16 - src_size % 16);
CRYPT_AESEncrypt(m_pAESContext, dest_buf + nblocks * 16 + 16, padding, 16);
@@ -719,9 +719,9 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F
}
}
typedef struct _AESCryptContext {
- FX_BYTE m_Context[2048];
+ uint8_t m_Context[2048];
FX_BOOL m_bIV;
- FX_BYTE m_Block[16];
+ uint8_t m_Block[16];
FX_DWORD m_BlockOffset;
} AESCryptContext;
FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt)
@@ -736,20 +736,20 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu
CRYPT_AESSetKey(pContext->m_Context, 16, m_EncryptKey, 32, bEncrypt);
if (bEncrypt) {
for (int i = 0; i < 16; i ++) {
- pContext->m_Block[i] = (FX_BYTE)rand();
+ pContext->m_Block[i] = (uint8_t)rand();
}
CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block);
}
return pContext;
}
- FX_BYTE key1[48];
+ uint8_t key1[48];
FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen);
FXSYS_memcpy32(key1 + m_KeyLen, &objnum, 3);
FXSYS_memcpy32(key1 + m_KeyLen + 3, &gennum, 2);
if (m_Cipher == FXCIPHER_AES) {
FXSYS_memcpy32(key1 + m_KeyLen + 5, "sAlT", 4);
}
- FX_BYTE realkey[16];
+ uint8_t realkey[16];
CRYPT_MD5Generate(key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey);
int realkeylen = m_KeyLen + 5;
if (realkeylen > 16) {
@@ -762,13 +762,13 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu
CRYPT_AESSetKey(pContext->m_Context, 16, realkey, 16, bEncrypt);
if (bEncrypt) {
for (int i = 0; i < 16; i ++) {
- pContext->m_Block[i] = (FX_BYTE)rand();
+ pContext->m_Block[i] = (uint8_t)rand();
}
CRYPT_AESSetIV(pContext->m_Context, pContext->m_Block);
}
return pContext;
}
- void* pContext = FX_Alloc(FX_BYTE, 1040);
+ void* pContext = FX_Alloc(uint8_t, 1040);
CRYPT_ArcFourSetup(pContext, realkey, realkeylen);
return pContext;
}
@@ -809,7 +809,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE sr
pContext->m_bIV = FALSE;
pContext->m_BlockOffset = 0;
} else if (src_off < src_size) {
- FX_BYTE block_buf[16];
+ uint8_t block_buf[16];
if (bEncrypt) {
CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16);
} else {
@@ -839,17 +839,17 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf
}
AESCryptContext* pContext = (AESCryptContext*)context;
if (bEncrypt) {
- FX_BYTE block_buf[16];
+ uint8_t block_buf[16];
if (pContext->m_BlockOffset == 16) {
CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16);
dest_buf.AppendBlock(block_buf, 16);
pContext->m_BlockOffset = 0;
}
- FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (FX_BYTE)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset);
+ FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (uint8_t)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset);
CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16);
dest_buf.AppendBlock(block_buf, 16);
} else if (pContext->m_BlockOffset == 16) {
- FX_BYTE block_buf[16];
+ uint8_t block_buf[16];
CRYPT_AESDecrypt(pContext->m_Context, block_buf, pContext->m_Block, 16);
if (block_buf[15] <= 16) {
dest_buf.AppendBlock(block_buf, 16 - block_buf[15]);
@@ -879,7 +879,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec
FXSYS_memcpy32(m_EncryptKey, key, m_KeyLen);
}
if (m_Cipher == FXCIPHER_AES) {
- m_pAESContext = FX_Alloc(FX_BYTE, 2048);
+ m_pAESContext = FX_Alloc(uint8_t, 2048);
}
return TRUE;
}
@@ -911,7 +911,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen)
m_KeyLen = keylen;
FXSYS_memcpy32(m_EncryptKey, key, keylen);
if (m_Cipher == FXCIPHER_AES) {
- m_pAESContext = FX_Alloc(FX_BYTE, 2048);
+ m_pAESContext = FX_Alloc(uint8_t, 2048);
}
return TRUE;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
index 6fa7419a41..8cb0cee82a 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
@@ -296,7 +296,7 @@ void CPDF_DecryptFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf)
extern "C" {
static void* my_alloc_func (void* opaque, unsigned int items, unsigned int size)
{
- return FX_Alloc2D(FX_BYTE, items, size);
+ return FX_Alloc2D(uint8_t, items, size);
}
static void my_free_func (void* opaque, void* address)
{
@@ -361,8 +361,8 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar
m_nLeftBits = 8 - new_bits;
m_LeftBits = src_buf[i] % (1 << m_nLeftBits);
if (code < 256) {
- dest_buf.AppendByte((FX_BYTE)code);
- m_LastChar = (FX_BYTE)code;
+ dest_buf.AppendByte((uint8_t)code);
+ m_LastChar = (uint8_t)code;
if (m_OldCode != -1) {
AddCode(m_OldCode, m_LastChar);
}
@@ -406,7 +406,7 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar
}
}
}
-void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, FX_BYTE append_char)
+void CPDF_LzwFilter::AddCode(FX_DWORD prefix_code, uint8_t append_char)
{
if (m_nCodes + m_bEarlyChange == 4094) {
return;
@@ -431,13 +431,13 @@ void CPDF_LzwFilter::DecodeString(FX_DWORD code)
if (m_StackLen >= sizeof(m_DecodeStack)) {
return;
}
- m_DecodeStack[m_StackLen++] = (FX_BYTE)data;
+ m_DecodeStack[m_StackLen++] = (uint8_t)data;
code = data >> 16;
}
if (m_StackLen >= sizeof(m_DecodeStack)) {
return;
}
- m_DecodeStack[m_StackLen++] = (FX_BYTE)code;
+ m_DecodeStack[m_StackLen++] = (uint8_t)code;
}
CPDF_PredictorFilter::CPDF_PredictorFilter(int predictor, int colors, int bpc, int cols)
{
@@ -461,23 +461,23 @@ CPDF_PredictorFilter::~CPDF_PredictorFilter()
FX_Free(m_pRefLine);
}
}
-static FX_BYTE PaethPredictor(int a, int b, int c)
+static uint8_t PaethPredictor(int a, int b, int c)
{
int p = a + b - c;
int pa = FXSYS_abs(p - a);
int pb = FXSYS_abs(p - b);
int pc = FXSYS_abs(p - c);
if (pa <= pb && pa <= pc) {
- return (FX_BYTE)a;
+ return (uint8_t)a;
}
if (pb <= pc) {
- return (FX_BYTE)b;
+ return (uint8_t)b;
}
- return (FX_BYTE)c;
+ return (uint8_t)c;
}
static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, int Bpp)
{
- FX_BYTE tag = cur_buf[0];
+ uint8_t tag = cur_buf[0];
if (tag == 0) {
return;
}
@@ -486,10 +486,10 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i
ref_buf ++;
}
for (int byte = 0; byte < pitch; byte ++) {
- FX_BYTE raw_byte = cur_buf[byte];
+ uint8_t raw_byte = cur_buf[byte];
switch (tag) {
case 1: {
- FX_BYTE left = 0;
+ uint8_t left = 0;
if (byte >= Bpp) {
left = cur_buf[byte - Bpp];
}
@@ -497,7 +497,7 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i
break;
}
case 2: {
- FX_BYTE up = 0;
+ uint8_t up = 0;
if (ref_buf) {
up = ref_buf[byte];
}
@@ -505,11 +505,11 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i
break;
}
case 3: {
- FX_BYTE left = 0;
+ uint8_t left = 0;
if (byte >= Bpp) {
left = cur_buf[byte - Bpp];
}
- FX_BYTE up = 0;
+ uint8_t up = 0;
if (ref_buf) {
up = ref_buf[byte];
}
@@ -517,15 +517,15 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i
break;
}
case 4: {
- FX_BYTE left = 0;
+ uint8_t left = 0;
if (byte >= Bpp) {
left = cur_buf[byte - Bpp];
}
- FX_BYTE up = 0;
+ uint8_t up = 0;
if (ref_buf) {
up = ref_buf[byte];
}
- FX_BYTE upper_left = 0;
+ uint8_t upper_left = 0;
if (byte >= Bpp && ref_buf) {
upper_left = ref_buf[byte - Bpp];
}
@@ -538,9 +538,9 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i
void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
if (m_pCurLine == NULL) {
- m_pCurLine = FX_Alloc(FX_BYTE, m_Pitch);
+ m_pCurLine = FX_Alloc(uint8_t, m_Pitch);
if (!m_bTiff) {
- m_pRefLine = FX_Alloc(FX_BYTE, m_Pitch);
+ m_pRefLine = FX_Alloc(uint8_t, m_Pitch);
}
}
while (1) {
@@ -579,7 +579,7 @@ CPDF_Ascii85Filter::CPDF_Ascii85Filter()
void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
for (FX_DWORD i = 0; i < src_size; i ++) {
- FX_BYTE byte = src_buf[i];
+ uint8_t byte = src_buf[i];
if (PDF_CharType[byte] == 'W') {
continue;
}
@@ -604,7 +604,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B
m_CharCount ++;
if (m_CharCount == 5) {
for (int i = 0; i < 4; i ++) {
- dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8));
+ dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8));
}
m_State = 0;
}
@@ -615,7 +615,7 @@ void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_B
m_CurDWord = m_CurDWord * 85 + 84;
}
for (i = 0; i < m_CharCount - 1; i ++) {
- dest_buf.AppendByte((FX_BYTE)(m_CurDWord >> (3 - i) * 8));
+ dest_buf.AppendByte((uint8_t)(m_CurDWord >> (3 - i) * 8));
}
}
m_State = 2;
@@ -638,7 +638,7 @@ CPDF_AsciiHexFilter::CPDF_AsciiHexFilter()
void CPDF_AsciiHexFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
for (FX_DWORD i = 0; i < src_size; i ++) {
- FX_BYTE byte = src_buf[i];
+ uint8_t byte = src_buf[i];
if (PDF_CharType[byte] == 'W') {
continue;
}
@@ -673,7 +673,7 @@ CPDF_RunLenFilter::CPDF_RunLenFilter()
void CPDF_RunLenFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
for (FX_DWORD i = 0; i < src_size; i ++) {
- FX_BYTE byte = src_buf[i];
+ uint8_t byte = src_buf[i];
switch (m_State) {
case 0:
if (byte < 128) {
@@ -755,7 +755,7 @@ void CPDF_JpegFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Bina
m_Pitch = m_Width * m_nComps;
}
if (m_pScanline == NULL) {
- m_pScanline = FX_Alloc(FX_BYTE, m_Pitch + 4);
+ m_pScanline = FX_Alloc(uint8_t, m_Pitch + 4);
}
while (1) {
if (!CPDF_ModuleMgr::Get()->GetJpegModule()->ReadScanline(m_pContext, m_pScanline)) {
@@ -803,8 +803,8 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign,
m_nRows = nRows;
m_nColumns = nColumns;
m_Pitch = (m_nColumns + 7) / 8;
- m_pScanlineBuf = FX_Alloc(FX_BYTE, m_Pitch);
- m_pRefBuf = FX_Alloc(FX_BYTE, m_Pitch);
+ m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch);
+ m_pRefBuf = FX_Alloc(uint8_t, m_Pitch);
FXSYS_memset8(m_pScanlineBuf, 0xff, m_Pitch);
FXSYS_memset8(m_pRefBuf, 0xff, m_Pitch);
m_iRow = 0;
@@ -839,9 +839,9 @@ void CPDF_FaxFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf)
{
ProcessData(m_InputBuf.GetBuffer(), m_InputBuf.GetSize(), m_InputBitPos, TRUE, dest_buf);
}
-FX_BOOL _FaxSkipEOL(const FX_BYTE* src_buf, int bitsize, int& bitpos);
-FX_BOOL _FaxG4GetRow(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const FX_BYTE* ref_buf, int columns);
-FX_BOOL _FaxGet1DLine(const FX_BYTE* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns);
+FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos);
+FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns);
+FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns);
void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
CFX_BinaryBuf& dest_buf)
{
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index c18668d683..d636f96b68 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -295,8 +295,8 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite
case PDFOBJ_REFERENCE: {
CPDF_Reference* pRef = (CPDF_Reference*)this;
FX_DWORD obj_num = pRef->m_RefObjNum;
- if (bDirect && !visited->GetValueAt((void*)(FX_UINTPTR)obj_num)) {
- visited->SetAt((void*)(FX_UINTPTR)obj_num, (void*)1);
+ if (bDirect && !visited->GetValueAt((void*)(uintptr_t)obj_num)) {
+ visited->SetAt((void*)(uintptr_t)obj_num, (void*)1);
CPDF_Object* ret;
if (pRef->GetDirect())
ret = pRef->GetDirect()->CloneInternal(TRUE, visited);
@@ -896,7 +896,7 @@ void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD
{
InitStream(pDict);
m_GenNum = (FX_DWORD) - 1;
- m_pDataBuf = FX_Alloc(FX_BYTE, size);
+ m_pDataBuf = FX_Alloc(uint8_t, size);
if (pData) {
FXSYS_memcpy32(m_pDataBuf, pData, size);
}
@@ -918,7 +918,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed,
if (bKeepBuf) {
m_pDataBuf = (FX_LPBYTE)pData;
} else {
- m_pDataBuf = FX_Alloc(FX_BYTE, size);
+ m_pDataBuf = FX_Alloc(uint8_t, size);
if (pData) {
FXSYS_memcpy32(m_pDataBuf, pData, size);
}
@@ -970,8 +970,8 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
if (!m_pFile || !pOther->m_pFile) {
return FALSE;
}
- FX_BYTE srcBuf[1024];
- FX_BYTE destBuf[1024];
+ uint8_t srcBuf[1024];
+ uint8_t destBuf[1024];
FX_DWORD size = m_dwSize;
FX_DWORD srcOffset = m_FileOffset;
FX_DWORD destOffset = pOther->m_FileOffset;
@@ -1008,7 +1008,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
if (NULL == pBuf) {
return FALSE;
}
- FX_BYTE srcBuf[1024];
+ uint8_t srcBuf[1024];
FX_DWORD size = m_dwSize;
while (size > 0) {
FX_DWORD actualSize = size > 1024 ? 1024 : size;
@@ -1040,7 +1040,7 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf
CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL);
CPDF_StreamFilter *pSF = GetStreamFilter(TRUE);
if (pSF) {
- FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, 4096);
+ FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096);
FX_DWORD dwRead;
do {
dwRead = pSF->ReadBlock(pBuf, 4096);
@@ -1086,7 +1086,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess,
return;
}
if (!pStream->IsMemoryBased()) {
- pSrcData = m_pSrcData = FX_Alloc(FX_BYTE, dwSrcSize);
+ pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) {
return;
}
@@ -1165,7 +1165,7 @@ FX_LPBYTE CPDF_StreamAcc::DetachData()
m_dwSize = 0;
return p;
}
- FX_LPBYTE p = FX_Alloc(FX_BYTE, m_dwSize);
+ FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize);
FXSYS_memcpy32(p, m_pData, m_dwSize);
return p;
}
@@ -1200,7 +1200,7 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR
}
FX_LPVOID value;
{
- if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) {
+ if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
if (((CPDF_Object*)value)->GetObjNum() == -1) {
return NULL;
}
@@ -1218,25 +1218,25 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR
if (m_LastObjNum < objnum) {
m_LastObjNum = objnum;
}
- if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) {
+ if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
if (value) {
((CPDF_Object *)value)->Destroy();
}
}
- m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj);
+ m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj);
return pObj;
}
int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum)
{
FX_LPVOID value;
- if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) {
+ if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
return ((CPDF_Object*)value)->GetType();
}
if (m_pParser) {
PARSE_CONTEXT context;
FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT));
context.m_Flags = PDFPARSE_TYPEONLY;
- return (int)(FX_UINTPTR)m_pParser->ParseIndirectObject(this, objnum, &context);
+ return (int)(uintptr_t)m_pParser->ParseIndirectObject(this, objnum, &context);
}
return 0;
}
@@ -1246,21 +1246,21 @@ FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj)
return pObj->m_ObjNum;
}
m_LastObjNum ++;
- m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)m_LastObjNum, pObj);
+ m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)m_LastObjNum, pObj);
pObj->m_ObjNum = m_LastObjNum;
return m_LastObjNum;
}
void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum)
{
FX_LPVOID value;
- if (!m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) {
+ if (!m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
return;
}
if (((CPDF_Object*)value)->GetObjNum() == -1) {
return;
}
((CPDF_Object*)value)->Destroy();
- m_IndirectObjs.RemoveKey((FX_LPVOID)(FX_UINTPTR)objnum);
+ m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum);
}
void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj)
{
@@ -1268,7 +1268,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO
return;
}
FX_LPVOID value = NULL;
- if (m_IndirectObjs.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, value)) {
+ if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
if (value)
{
if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum())
@@ -1278,7 +1278,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO
}
}
pObj->m_ObjNum = objnum;
- m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj);
+ m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj);
if (m_LastObjNum < objnum) {
m_LastObjNum = objnum;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 9c35615a72..4afc3a668b 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -27,7 +27,7 @@ FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict)
}
return FALSE;
}
-static FX_INT32 _CompareDWord(const void* p1, const void* p2)
+static int32_t _CompareDWord(const void* p1, const void* p2)
{
return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2);
}
@@ -98,8 +98,8 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse)
m_CrossRef.RemoveAll();
m_V5Type.RemoveAll();
m_ObjVersion.RemoveAll();
- FX_INT32 iLen = m_Trailers.GetSize();
- for (FX_INT32 i = 0; i < iLen; ++i) {
+ int32_t iLen = m_Trailers.GetSize();
+ for (int32_t i = 0; i < iLen; ++i) {
if (CPDF_Dictionary* trailer = m_Trailers.GetAt(i))
trailer->Release();
}
@@ -109,11 +109,11 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse)
m_pLinearized = NULL;
}
}
-static FX_INT32 GetHeaderOffset(IFX_FileRead* pFile)
+static int32_t GetHeaderOffset(IFX_FileRead* pFile)
{
FX_DWORD tag = FXDWORD_FROM_LSBFIRST(0x46445025);
- FX_BYTE buf[4];
- FX_INT32 offset = 0;
+ uint8_t buf[4];
+ int32_t offset = 0;
while (1) {
if (!pFile->ReadBlock(buf, offset, 4)) {
return -1;
@@ -152,7 +152,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX
m_bXRefStream = FALSE;
m_LastXRefOffset = 0;
m_bOwnFileRead = bOwnFileRead;
- FX_INT32 offset = GetHeaderOffset(pFileAccess);
+ int32_t offset = GetHeaderOffset(pFileAccess);
if (offset == -1) {
if (bOwnFileRead && pFileAccess) {
pFileAccess->Release();
@@ -160,7 +160,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX
return PDFPARSE_ERROR_FORMAT;
}
m_Syntax.InitParser(pFileAccess, offset);
- FX_BYTE ch;
+ uint8_t ch;
if (!m_Syntax.GetCharAt(5, ch)) {
return PDFPARSE_ERROR_FORMAT;
}
@@ -331,11 +331,11 @@ FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum)
return m_CrossRef[objnum];
}
if (m_V5Type[objnum] == 2) {
- return m_CrossRef[(FX_INT32)m_CrossRef[objnum]];
+ return m_CrossRef[(int32_t)m_CrossRef[objnum]];
}
return 0;
}
-static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key)
+static int32_t GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key)
{
CPDF_Object* pObj = pDict->GetElement(key);
if (pObj == NULL) {
@@ -346,7 +346,7 @@ static FX_INT32 GetDirectInteger(CPDF_Dictionary* pDict, FX_BSTR key)
}
return 0;
}
-static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, FX_INT32 iType)
+static FX_BOOL CheckDirectType(CPDF_Dictionary* pDict, FX_BSTR key, int32_t iType)
{
CPDF_Object* pObj = pDict->GetElement(key);
if (!pObj) {
@@ -363,7 +363,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos)
if (m_pTrailer == NULL) {
return FALSE;
}
- FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
if (xrefsize <= 0 || xrefsize > (1 << 20)) {
return FALSE;
}
@@ -400,7 +400,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos)
XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm")));
m_Trailers.Add(pDict);
}
- for (FX_INT32 i = 0; i < CrossRefList.GetSize(); i ++)
+ for (int32_t i = 0; i < CrossRefList.GetSize(); i ++)
if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) {
return FALSE;
}
@@ -415,7 +415,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d
if (m_pTrailer == NULL) {
return FALSE;
}
- FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
if (xrefsize == 0) {
return FALSE;
}
@@ -434,7 +434,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos, FX_DWORD d
XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm")));
m_Trailers.Add(pDict);
}
- for (FX_INT32 i = 1; i < CrossRefList.GetSize(); i ++)
+ for (int32_t i = 1; i < CrossRefList.GetSize(); i ++)
if (!LoadCrossRefV4(CrossRefList[i], XRefStreamList[i], FALSE, i == 0)) {
return FALSE;
}
@@ -451,12 +451,12 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
FX_DWORD start_objnum = 0;
FX_DWORD count = dwObjCount;
FX_FILESIZE SavedPos = m_Syntax.SavePos();
- FX_INT32 recordsize = 20;
+ int32_t recordsize = 20;
char* pBuf = FX_Alloc(char, 1024 * recordsize + 1);
pBuf[1024 * recordsize] = '\0';
- FX_INT32 nBlocks = count / 1024 + 1;
- for (FX_INT32 block = 0; block < nBlocks; block ++) {
- FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024;
+ int32_t nBlocks = count / 1024 + 1;
+ for (int32_t block = 0; block < nBlocks; block ++) {
+ int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
FX_DWORD dwReadSize = block_size * recordsize;
if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_Syntax.m_FileLen) {
FX_Free(pBuf);
@@ -466,16 +466,16 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
FX_Free(pBuf);
return FALSE;
}
- for (FX_INT32 i = 0; i < block_size; i ++) {
+ for (int32_t i = 0; i < block_size; i ++) {
FX_DWORD objnum = start_objnum + block * 1024 + i;
char* pEntry = pBuf + i * recordsize;
if (pEntry[17] == 'f') {
m_CrossRef.SetAtGrow(objnum, 0);
m_V5Type.SetAtGrow(objnum, 0);
} else {
- FX_INT32 offset = FXSYS_atoi(pEntry);
+ int32_t offset = FXSYS_atoi(pEntry);
if (offset == 0) {
- for (FX_INT32 c = 0; c < 10; c ++) {
+ for (int32_t c = 0; c < 10; c ++) {
if (pEntry[c] < '0' || pEntry[c] > '9') {
FX_Free(pBuf);
return FALSE;
@@ -483,7 +483,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
}
}
m_CrossRef.SetAtGrow(objnum, offset);
- FX_INT32 version = FXSYS_atoi(pEntry + 11);
+ int32_t version = FXSYS_atoi(pEntry + 11);
if (version >= 1) {
m_bVersionUpdated = TRUE;
}
@@ -537,7 +537,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
m_Syntax.ToNextWord();
SavedPos = m_Syntax.SavePos();
FX_BOOL bFirstItem = FALSE;
- FX_INT32 recordsize = 20;
+ int32_t recordsize = 20;
if (bFirst) {
bFirstItem = TRUE;
}
@@ -545,12 +545,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
if (!bSkip) {
char* pBuf = FX_Alloc(char, 1024 * recordsize + 1);
pBuf[1024 * recordsize] = '\0';
- FX_INT32 nBlocks = count / 1024 + 1;
+ int32_t nBlocks = count / 1024 + 1;
FX_BOOL bFirstBlock = TRUE;
- for (FX_INT32 block = 0; block < nBlocks; block ++) {
- FX_INT32 block_size = block == nBlocks - 1 ? count % 1024 : 1024;
+ for (int32_t block = 0; block < nBlocks; block ++) {
+ int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
m_Syntax.ReadBlock((FX_LPBYTE)pBuf, block_size * recordsize);
- for (FX_INT32 i = 0; i < block_size; i ++) {
+ for (int32_t i = 0; i < block_size; i ++) {
FX_DWORD objnum = start_objnum + block * 1024 + i;
char* pEntry = pBuf + i * recordsize;
if (pEntry[17] == 'f') {
@@ -560,7 +560,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
}
if (bFirstBlock) {
FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry);
- FX_INT32 version = FXSYS_atoi(pEntry + 11);
+ int32_t version = FXSYS_atoi(pEntry + 11);
if (offset == 0 && version == 65535 && start_objnum != 0) {
start_objnum--;
objnum = 0;
@@ -571,7 +571,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
} else {
FX_FILESIZE offset = (FX_FILESIZE)FXSYS_atoi64(pEntry);
if (offset == 0) {
- for (FX_INT32 c = 0; c < 10; c ++) {
+ for (int32_t c = 0; c < 10; c ++) {
if (pEntry[c] < '0' || pEntry[c] > '9') {
FX_Free(pBuf);
return FALSE;
@@ -579,7 +579,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
}
}
m_CrossRef.SetAtGrow(objnum, offset);
- FX_INT32 version = FXSYS_atoi(pEntry + 11);
+ int32_t version = FXSYS_atoi(pEntry + 11);
if (version >= 1) {
m_bVersionUpdated = TRUE;
}
@@ -630,11 +630,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
m_pTrailer->Release();
m_pTrailer = NULL;
}
- FX_INT32 status = 0;
- FX_INT32 inside_index = 0;
+ int32_t status = 0;
+ int32_t inside_index = 0;
FX_DWORD objnum = 0, gennum = 0;
- FX_INT32 depth = 0;
- FX_LPBYTE buffer = FX_Alloc(FX_BYTE, 4096);
+ int32_t depth = 0;
+ FX_LPBYTE buffer = FX_Alloc(uint8_t, 4096);
FX_FILESIZE pos = m_Syntax.m_HeaderOffset;
FX_FILESIZE start_pos = 0, start_pos1 = 0;
FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1;
@@ -648,7 +648,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
break;
}
for (FX_DWORD i = 0; i < size; i ++) {
- FX_BYTE byte = buffer[i];
+ uint8_t byte = buffer[i];
switch (status) {
case 0:
if (PDF_CharType[byte] == 'W') {
@@ -822,11 +822,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
} else {
i += (FX_DWORD)nLen;
}
- if (m_CrossRef.GetSize() > (FX_INT32)objnum && m_CrossRef[objnum]) {
+ if (m_CrossRef.GetSize() > (int32_t)objnum && m_CrossRef[objnum]) {
if (pObject) {
FX_DWORD oldgen = m_ObjVersion.GetAt(objnum);
m_CrossRef[objnum] = obj_pos;
- m_ObjVersion.SetAt(objnum, (FX_SHORT)gennum);
+ m_ObjVersion.SetAt(objnum, (int16_t)gennum);
if (oldgen != gennum) {
m_bVersionUpdated = TRUE;
}
@@ -834,7 +834,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
} else {
m_CrossRef.SetAtGrow(objnum, obj_pos);
m_V5Type.SetAtGrow(objnum, 1);
- m_ObjVersion.SetAtGrow(objnum, (FX_SHORT)gennum);
+ m_ObjVersion.SetAtGrow(objnum, (int16_t)gennum);
}
if (pObject) {
pObject->Release();
@@ -990,10 +990,10 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
FX_Free(buffer);
return TRUE;
}
-static FX_DWORD _GetVarInt(FX_LPCBYTE p, FX_INT32 n)
+static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n)
{
FX_DWORD result = 0;
- for (FX_INT32 i = 0; i < n; i ++) {
+ for (int32_t i = 0; i < n; i ++) {
result = result * 256 + p[i];
}
return result;
@@ -1019,7 +1019,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
return FALSE;
}
prev = pStream->GetDict()->GetInteger(FX_BSTRC("Prev"));
- FX_INT32 size = pStream->GetDict()->GetInteger(FX_BSTRC("Size"));
+ int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size"));
if (size < 0) {
pStream->Release();
return FALSE;
@@ -1033,7 +1033,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
} else {
m_Trailers.Add((CPDF_Dictionary*)pStream->GetDict()->Clone());
}
- std::vector<std::pair<FX_INT32, FX_INT32> > arrIndex;
+ std::vector<std::pair<int32_t, int32_t> > arrIndex;
CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index"));
if (pArray) {
FX_DWORD nPairSize = pArray->GetCount() / 2;
@@ -1075,12 +1075,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
FX_DWORD dwTotalSize = acc.GetSize();
FX_DWORD segindex = 0;
for (FX_DWORD i = 0; i < arrIndex.size(); i ++) {
- FX_INT32 startnum = arrIndex[i].first;
+ int32_t startnum = arrIndex[i].first;
if (startnum < 0) {
continue;
}
- m_dwXrefStartObjNum = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (startnum);
- FX_DWORD count = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (arrIndex[i].second);
+ 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);
FX_SAFE_DWORD dwCaculatedSize = segindex;
dwCaculatedSize += count;
dwCaculatedSize *= totalWidth;
@@ -1090,12 +1090,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
FX_LPCBYTE segstart = pData + segindex * totalWidth;
FX_SAFE_DWORD dwMaxObjNum = startnum;
dwMaxObjNum += count;
- FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, FX_INT32> (m_V5Type.GetSize());
+ FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, int32_t> (m_V5Type.GetSize());
if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size) {
continue;
}
for (FX_DWORD j = 0; j < count; j ++) {
- FX_INT32 type = 1;
+ int32_t type = 1;
FX_LPCBYTE entrystart = segstart + j * totalWidth;
if (WidthArray[0]) {
type = _GetVarInt(entrystart, WidthArray[0]);
@@ -1212,8 +1212,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX
if (pObjStream == NULL) {
return NULL;
}
- FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
- FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
+ int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
+ int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
CPDF_SyntaxParser syntax;
CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE));
syntax.InitParser(file.Get(), 0);
@@ -1235,7 +1235,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX
CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum)
{
CPDF_StreamAcc* pStreamAcc = NULL;
- if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) {
+ if (m_ObjectStreamMap.Lookup((void*)(uintptr_t)objnum, (void*&)pStreamAcc)) {
return pStreamAcc;
}
const CPDF_Stream* pStream = m_pDocument ? (CPDF_Stream*)m_pDocument->GetIndirectObject(objnum) : NULL;
@@ -1244,7 +1244,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum)
}
pStreamAcc = new CPDF_StreamAcc;
pStreamAcc->LoadAllData(pStream);
- m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc);
+ m_ObjectStreamMap.SetAt((void*)(uintptr_t)objnum, pStreamAcc);
return pStreamAcc;
}
FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum)
@@ -1283,8 +1283,8 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR
if (pObjStream == NULL) {
return;
}
- FX_INT32 n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
- FX_INT32 offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
+ int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
+ int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
CPDF_SyntaxParser syntax;
FX_LPCBYTE pData = pObjStream->GetData();
FX_DWORD totalsize = pObjStream->GetSize();
@@ -1301,7 +1301,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR
FX_DWORD nextoff = syntax.GetDirectNum();
size = nextoff - thisoff;
}
- pBuffer = FX_Alloc(FX_BYTE, size);
+ pBuffer = FX_Alloc(uint8_t, size);
FXSYS_memcpy32(pBuffer, pData + thisoff + offset, size);
return;
}
@@ -1368,7 +1368,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR
nextoff = m_Syntax.SavePos();
}
size = (FX_DWORD)(nextoff - pos);
- pBuffer = FX_Alloc(FX_BYTE, size);
+ pBuffer = FX_Alloc(uint8_t, size);
m_Syntax.RestorePos(pos);
m_Syntax.ReadBlock(pBuffer, size);
m_Syntax.RestorePos(SavedPos);
@@ -1553,7 +1553,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse
m_bXRefStream = FALSE;
m_LastXRefOffset = 0;
m_bOwnFileRead = bOwnFileRead;
- FX_INT32 offset = GetHeaderOffset(pFileAccess);
+ int32_t offset = GetHeaderOffset(pFileAccess);
if (offset == -1) {
return PDFPARSE_ERROR_FORMAT;
}
@@ -1579,7 +1579,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse
if (m_pTrailer == NULL) {
return FALSE;
}
- FX_INT32 xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
if (xrefsize > 0) {
m_CrossRef.SetSize(xrefsize);
m_V5Type.SetSize(xrefsize);
@@ -1651,10 +1651,10 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable()
m_pTrailer = NULL;
}
m_Syntax.RestorePos(m_LastXRefOffset - m_Syntax.m_HeaderOffset);
- FX_BYTE ch = 0;
+ uint8_t ch = 0;
FX_DWORD dwCount = 0;
m_Syntax.GetNextChar(ch);
- FX_INT32 type = PDF_CharType[ch];
+ int32_t type = PDF_CharType[ch];
while (type == 'W') {
++dwCount;
if (m_Syntax.m_FileLen >= (FX_FILESIZE)(m_Syntax.SavePos() + m_Syntax.m_HeaderOffset)) {
@@ -1702,7 +1702,7 @@ CPDF_SyntaxParser::~CPDF_SyntaxParser()
FX_Free(m_pFileBuf);
}
}
-FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch)
+FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, uint8_t& ch)
{
FX_FILESIZE save_pos = m_Pos;
m_Pos = pos;
@@ -1710,7 +1710,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAt(FX_FILESIZE pos, FX_BYTE& ch)
m_Pos = save_pos;
return ret;
}
-FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch)
+FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch)
{
FX_FILESIZE pos = m_Pos + m_HeaderOffset;
if (pos >= m_FileLen) {
@@ -1739,7 +1739,7 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(FX_BYTE& ch)
m_Pos ++;
return TRUE;
}
-FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, FX_BYTE& ch)
+FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch)
{
pos += m_HeaderOffset;
if (pos >= m_FileLen) {
@@ -1782,11 +1782,11 @@ void CPDF_SyntaxParser::GetNextWord()
{
m_WordSize = 0;
m_bIsNumber = TRUE;
- FX_BYTE ch;
+ uint8_t ch;
if (!GetNextChar(ch)) {
return;
}
- FX_BYTE type = PDF_CharType[ch];
+ uint8_t type = PDF_CharType[ch];
while (1) {
while (type == 'W') {
if (!GetNextChar(ch)) {
@@ -1864,13 +1864,13 @@ void CPDF_SyntaxParser::GetNextWord()
}
CFX_ByteString CPDF_SyntaxParser::ReadString()
{
- FX_BYTE ch;
+ uint8_t ch;
if (!GetNextChar(ch)) {
return CFX_ByteString();
}
CFX_ByteTextBuf buf;
- FX_INT32 parlevel = 0;
- FX_INT32 status = 0, iEscCode = 0;
+ int32_t parlevel = 0;
+ int32_t status = 0, iEscCode = 0;
while (1) {
switch (status) {
case 0:
@@ -1951,13 +1951,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadString()
}
CFX_ByteString CPDF_SyntaxParser::ReadHexString()
{
- FX_BYTE ch;
+ uint8_t ch;
if (!GetNextChar(ch)) {
return CFX_ByteString();
}
CFX_BinaryBuf buf;
FX_BOOL bFirst = TRUE;
- FX_BYTE code = 0;
+ uint8_t code = 0;
while (1) {
if (ch == '>') {
break;
@@ -1967,7 +1967,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString()
code = (ch - '0') * 16;
} else {
code += ch - '0';
- buf.AppendByte((FX_BYTE)code);
+ buf.AppendByte((uint8_t)code);
}
bFirst = !bFirst;
} else if (ch >= 'A' && ch <= 'F') {
@@ -1975,7 +1975,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString()
code = (ch - 'A' + 10) * 16;
} else {
code += ch - 'A' + 10;
- buf.AppendByte((FX_BYTE)code);
+ buf.AppendByte((uint8_t)code);
}
bFirst = !bFirst;
} else if (ch >= 'a' && ch <= 'f') {
@@ -1983,7 +1983,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString()
code = (ch - 'a' + 10) * 16;
} else {
code += ch - 'a' + 10;
- buf.AppendByte((FX_BYTE)code);
+ buf.AppendByte((uint8_t)code);
}
bFirst = !bFirst;
}
@@ -1992,13 +1992,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString()
}
}
if (!bFirst) {
- buf.AppendByte((FX_BYTE)code);
+ buf.AppendByte((uint8_t)code);
}
return buf.GetByteString();
}
void CPDF_SyntaxParser::ToNextLine()
{
- FX_BYTE ch;
+ uint8_t ch;
while (1) {
if (!GetNextChar(ch)) {
return;
@@ -2019,11 +2019,11 @@ void CPDF_SyntaxParser::ToNextLine()
}
void CPDF_SyntaxParser::ToNextWord()
{
- FX_BYTE ch;
+ uint8_t ch;
if (!GetNextChar(ch)) {
return;
}
- FX_BYTE type = PDF_CharType[ch];
+ uint8_t type = PDF_CharType[ch];
while (1) {
while (type == 'W') {
m_dwWordPos = m_Pos;
@@ -2168,7 +2168,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
pContext->m_DictStart = SavedPos;
}
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
- FX_INT32 nKeys = 0;
+ int32_t nKeys = 0;
FX_FILESIZE dwSignValuePos = 0;
while (1) {
FX_BOOL bIsNumber;
@@ -2377,7 +2377,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
if (pDict) {
pDict->Release();
}
- FX_BYTE ch;
+ uint8_t ch;
while (1) {
if (!GetNextChar(ch)) {
break;
@@ -2461,7 +2461,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT
} else {
m_Pos = curPos;
}
- FX_BYTE byte1, byte2;
+ uint8_t byte1, byte2;
GetCharAt(StreamStartPos + offset - 1, byte1);
GetCharAt(StreamStartPos + offset - 2, byte2);
if (byte1 == 0x0a && byte2 == 0x0d) {
@@ -2481,7 +2481,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT
m_Pos = StreamStartPos;
}
CPDF_Stream* pStream;
- FX_LPBYTE pData = FX_Alloc(FX_BYTE, len);
+ FX_LPBYTE pData = FX_Alloc(uint8_t, len);
ReadBlock(pData, len);
if (pCryptoHandler) {
CFX_BinaryBuf dest_buf;
@@ -2511,7 +2511,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff
FX_Free(m_pFileBuf);
m_pFileBuf = NULL;
}
- m_pFileBuf = FX_Alloc(FX_BYTE, m_BufSize);
+ m_pFileBuf = FX_Alloc(uint8_t, m_BufSize);
m_HeaderOffset = HeaderOffset;
m_FileLen = pFileAccess->GetSize();
m_Pos = 0;
@@ -2519,7 +2519,7 @@ void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOff
m_BufOffset = 0;
pFileAccess->ReadBlock(m_pFileBuf, 0, (size_t)((FX_FILESIZE)m_BufSize > m_FileLen ? m_FileLen : m_BufSize));
}
-FX_INT32 CPDF_SyntaxParser::GetDirectNum()
+int32_t CPDF_SyntaxParser::GetDirectNum()
{
GetNextWord();
if (!m_bIsNumber) {
@@ -2530,19 +2530,19 @@ FX_INT32 CPDF_SyntaxParser::GetDirectNum()
}
FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen)
{
- FX_BYTE type = PDF_CharType[tag[0]];
+ uint8_t type = PDF_CharType[tag[0]];
FX_BOOL bCheckLeft = type != 'D' && type != 'W';
type = PDF_CharType[tag[taglen - 1]];
FX_BOOL bCheckRight = type != 'D' && type != 'W';
- FX_BYTE ch;
- if (bCheckRight && startpos + (FX_INT32)taglen <= limit && GetCharAt(startpos + (FX_INT32)taglen, ch)) {
- FX_BYTE type = PDF_CharType[ch];
+ uint8_t ch;
+ if (bCheckRight && startpos + (int32_t)taglen <= limit && GetCharAt(startpos + (int32_t)taglen, ch)) {
+ uint8_t type = PDF_CharType[ch];
if (type == 'N' || type == 'R') {
return FALSE;
}
}
if (bCheckLeft && startpos > 0 && GetCharAt(startpos - 1, ch)) {
- FX_BYTE type = PDF_CharType[ch];
+ uint8_t type = PDF_CharType[ch];
if (type == 'N' || type == 'R') {
return FALSE;
}
@@ -2551,17 +2551,17 @@ FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit,
}
FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL bForward, FX_FILESIZE limit)
{
- FX_INT32 taglen = tag.GetLength();
+ int32_t taglen = tag.GetLength();
if (taglen == 0) {
return FALSE;
}
FX_FILESIZE pos = m_Pos;
- FX_INT32 offset = 0;
+ int32_t offset = 0;
if (!bForward) {
offset = taglen - 1;
}
FX_LPCBYTE tag_data = tag.GetPtr();
- FX_BYTE byte;
+ uint8_t byte;
while (1) {
if (bForward) {
if (limit) {
@@ -2620,9 +2620,9 @@ struct _SearchTagRecord {
FX_DWORD m_Len;
FX_DWORD m_Offset;
};
-FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit)
+int32_t CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX_FILESIZE limit)
{
- FX_INT32 ntags = 1, i;
+ int32_t ntags = 1, i;
for (i = 0; i < tags.GetLength(); i ++)
if (tags[i] == 0) {
ntags ++;
@@ -2643,9 +2643,9 @@ FX_INT32 CPDF_SyntaxParser::SearchMultiWord(FX_BSTR tags, FX_BOOL bWholeWord, FX
}
}
FX_FILESIZE pos = m_Pos;
- FX_BYTE byte;
+ uint8_t byte;
GetCharAt(pos++, byte);
- FX_INT32 found = -1;
+ int32_t found = -1;
while (1) {
for (i = 0; i < ntags; i ++) {
if (pPatterns[i].m_pTag[pPatterns[i].m_Offset] == byte) {
@@ -2684,12 +2684,12 @@ end:
}
FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit)
{
- FX_INT32 taglen = tag.GetLength();
- FX_INT32 match = 0;
+ int32_t taglen = tag.GetLength();
+ int32_t match = 0;
limit += m_Pos;
FX_FILESIZE startpos = m_Pos;
while (1) {
- FX_BYTE ch;
+ uint8_t ch;
if (!GetNextChar(ch)) {
return -1;
}
@@ -2707,10 +2707,10 @@ FX_FILESIZE CPDF_SyntaxParser::FindTag(FX_BSTR tag, FX_FILESIZE limit)
}
return -1;
}
-void CPDF_SyntaxParser::GetBinary(FX_BYTE* buffer, FX_DWORD size)
+void CPDF_SyntaxParser::GetBinary(uint8_t* buffer, FX_DWORD size)
{
FX_DWORD offset = 0;
- FX_BYTE ch;
+ uint8_t ch;
while (1) {
if (!GetNextChar(ch)) {
return;
@@ -2734,9 +2734,9 @@ public:
virtual FX_BOOL IsPageAvail(int iPage, IFX_DownloadHints* pHints) override;
- virtual FX_INT32 IsFormAvail(IFX_DownloadHints *pHints) override;
+ virtual int32_t IsFormAvail(IFX_DownloadHints *pHints) override;
- virtual FX_INT32 IsLinearizedPDF() override;
+ virtual int32_t IsLinearizedPDF() override;
virtual FX_BOOL IsLinearized() override
{
@@ -2770,11 +2770,11 @@ protected:
FX_BOOL CheckPageStatus(IFX_DownloadHints* pHints);
FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints);
- FX_INT32 CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset);
+ int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset);
FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
FX_BOOL GetNextToken(CFX_ByteString &token);
- FX_BOOL GetNextChar(FX_BYTE &ch);
+ FX_BOOL GetNextChar(uint8_t &ch);
CPDF_Object * ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD objnum);
CPDF_Object * GetObject(FX_DWORD objnum, IFX_DownloadHints* pHints, FX_BOOL *pExistInFile);
FX_BOOL GetPageKids(CPDF_Parser *pParser, CPDF_Object *pPages);
@@ -2788,10 +2788,10 @@ protected:
FX_BOOL CheckLinearizedFirstPage(int iPage, IFX_DownloadHints* pHints);
FX_BOOL HaveResourceAncestor(CPDF_Dictionary *pDict);
- FX_BOOL CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints);
+ FX_BOOL CheckPage(int32_t iPage, IFX_DownloadHints* pHints);
FX_BOOL LoadDocPages(IFX_DownloadHints* pHints);
- FX_BOOL LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints);
- FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints);
+ FX_BOOL LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints);
+ FX_BOOL CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints);
FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints);
FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPageNode, IFX_DownloadHints* pHints);
FX_BOOL CheckPageCount(IFX_DownloadHints* pHints);
@@ -2842,11 +2842,11 @@ protected:
CFX_ByteString m_WordBuf;
- FX_BYTE m_WordBuffer[257];
+ uint8_t m_WordBuffer[257];
FX_DWORD m_WordSize;
- FX_BYTE m_bufferData[512];
+ uint8_t m_bufferData[512];
CFX_FileSizeArray m_CrossOffset;
@@ -2994,8 +2994,8 @@ CPDF_DataAvail::~CPDF_DataAvail()
if (m_pagesLoadState) {
delete m_pagesLoadState;
}
- FX_INT32 i = 0;
- FX_INT32 iSize = m_arrayAcroforms.GetSize();
+ int32_t i = 0;
+ int32_t iSize = m_arrayAcroforms.GetSize();
for (i = 0; i < iSize; ++i) {
((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release();
}
@@ -3039,13 +3039,13 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa
}
FX_DWORD count = 0;
CFX_PtrArray new_obj_array;
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i < obj_array.GetSize(); i++) {
CPDF_Object *pObj = (CPDF_Object *)obj_array[i];
if (!pObj) {
continue;
}
- FX_INT32 type = pObj->GetType();
+ int32_t type = pObj->GetType();
switch (type) {
case PDFOBJ_ARRAY: {
CPDF_Array *pArray = pObj->GetArray();
@@ -3111,10 +3111,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(CFX_PtrArray& obj_array, FX_BOOL bParsePa
}
}
if (count > 0) {
- FX_INT32 iSize = new_obj_array.GetSize();
+ int32_t iSize = new_obj_array.GetSize();
for (i = 0; i < iSize; ++i) {
CPDF_Object *pObj = (CPDF_Object *)new_obj_array[i];
- FX_INT32 type = pObj->GetType();
+ int32_t type = pObj->GetType();
if (type == PDFOBJ_REFERENCE) {
CPDF_Reference *pRef = (CPDF_Reference *)pObj;
FX_DWORD dwNum = pRef->GetRefObjNum();
@@ -3162,8 +3162,8 @@ FX_BOOL CPDF_DataAvail::CheckAcroFormSubObject(IFX_DownloadHints* pHints)
CFX_PtrArray new_objs_array;
FX_BOOL bRet = IsObjectsAvail(m_objs_array, FALSE, pHints, new_objs_array);
if (bRet) {
- FX_INT32 iSize = m_arrayAcroforms.GetSize();
- for (FX_INT32 i = 0; i < iSize; ++i) {
+ int32_t iSize = m_arrayAcroforms.GetSize();
+ for (int32_t i = 0; i < iSize; ++i) {
((CPDF_Object *)m_arrayAcroforms.GetAt(i))->Release();
}
m_arrayAcroforms.RemoveAll();
@@ -3475,9 +3475,9 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints)
if (pObj->GetType() == PDFOBJ_ARRAY) {
CPDF_Array *pArray = pObj->GetArray();
if (pArray) {
- FX_INT32 iSize = pArray->GetCount();
+ int32_t iSize = pArray->GetCount();
CPDF_Object *pItem = NULL;
- for (FX_INT32 j = 0; j < iSize; ++j) {
+ for (int32_t j = 0; j < iSize; ++j) {
pItem = pArray->GetElement(j);
if (pItem && pItem->GetType() == PDFOBJ_REFERENCE) {
UnavailObjList.Add(((CPDF_Reference *)pItem)->GetRefObjNum());
@@ -3589,7 +3589,7 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints)
req_size = (FX_DWORD)m_dwFileLen;
}
if (m_pFileAvail->IsDataAvail(0, req_size)) {
- FX_BYTE buffer[1024];
+ uint8_t buffer[1024];
m_pFileRead->ReadBlock(buffer, 0, req_size);
if (IsLinearizedFile(buffer, req_size)) {
m_docStatus = PDF_DATAAVAIL_FIRSTPAGE;
@@ -3629,8 +3629,8 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints *pHints)
if ((FX_FILESIZE)dwEnd > m_dwFileLen) {
dwEnd = (FX_DWORD)m_dwFileLen;
}
- FX_INT32 iStartPos = (FX_INT32)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen);
- FX_INT32 iSize = dwEnd > 1024 ? dwEnd - 1024 : 0;
+ int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen);
+ int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0;
if (!m_pFileAvail->IsDataAvail(iStartPos, iSize)) {
pHints->AddSegment(iStartPos, iSize);
bNeedDownLoad = TRUE;
@@ -3690,7 +3690,7 @@ CPDF_Object * CPDF_DataAvail::ParseIndirectObjectAt(FX_FILESIZE pos, FX_DWORD ob
m_syntaxParser.RestorePos(SavedPos);
return pObj;
}
-FX_INT32 CPDF_DataAvail::IsLinearizedPDF()
+int32_t CPDF_DataAvail::IsLinearizedPDF()
{
FX_DWORD req_size = 1024;
if (!m_pFileAvail->IsDataAvail(0, req_size)) {
@@ -3703,7 +3703,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF()
if (dwSize < (FX_FILESIZE)req_size) {
return PDF_UNKNOW_LINEARIZED;
}
- FX_BYTE buffer[1024];
+ uint8_t buffer[1024];
m_pFileRead->ReadBlock(buffer, 0, req_size);
if (IsLinearizedFile(buffer, req_size)) {
return PDF_IS_LINEARIZED;
@@ -3713,7 +3713,7 @@ FX_INT32 CPDF_DataAvail::IsLinearizedPDF()
FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen)
{
CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE));
- FX_INT32 offset = GetHeaderOffset(file.Get());
+ int32_t offset = GetHeaderOffset(file.Get());
if (offset == -1) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -3757,7 +3757,7 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints)
FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos);
if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) {
- FX_BYTE buffer[1024];
+ uint8_t buffer[1024];
m_pFileRead->ReadBlock(buffer, req_pos, dwSize);
CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE));
m_syntaxParser.InitParser(file.Get(), 0);
@@ -3787,12 +3787,12 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints)
pHints->AddSegment(req_pos, dwSize);
return FALSE;
}
-FX_INT32 CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset)
+int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESIZE &xref_offset)
{
xref_offset = 0;
FX_DWORD req_size = (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) {
- FX_INT32 iSize = (FX_INT32)(m_Pos + req_size - m_dwCurrentXRefSteam);
+ int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam);
CFX_BinaryBuf buf(iSize);
FX_LPBYTE pBuf = buf.GetBuffer();
m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
@@ -3836,11 +3836,11 @@ inline void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset)
FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
{
m_WordSize = 0;
- FX_BYTE ch;
+ uint8_t ch;
if (!GetNextChar(ch)) {
return FALSE;
}
- FX_BYTE type = PDF_CharType[ch];
+ uint8_t type = PDF_CharType[ch];
while (1) {
while (type == 'W') {
if (!GetNextChar(ch)) {
@@ -3919,7 +3919,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString &token)
token = ret;
return TRUE;
}
-FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch)
+FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t &ch)
{
FX_FILESIZE pos = m_Pos;
if (pos >= m_dwFileLen) {
@@ -3946,11 +3946,11 @@ FX_BOOL CPDF_DataAvail::GetNextChar(FX_BYTE &ch)
}
FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints)
{
- FX_INT32 iSize = 0;
+ int32_t iSize = 0;
CFX_ByteString token;
while (1) {
if (!GetNextToken(token)) {
- iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
return FALSE;
}
@@ -3964,7 +3964,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRefItem(IFX_DownloadHints *pHints)
FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints)
{
FX_FILESIZE xref_offset = 0;
- FX_INT32 nRet = CheckCrossRefStream(pHints, xref_offset);
+ int32_t nRet = CheckCrossRefStream(pHints, xref_offset);
if (nRet == 1) {
if (!xref_offset) {
m_docStatus = PDF_DATAAVAIL_LOADALLCRSOSSREF;
@@ -3980,10 +3980,10 @@ FX_BOOL CPDF_DataAvail::CheckAllCrossRefStream(IFX_DownloadHints *pHints)
}
FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints)
{
- FX_INT32 iSize = 0;
+ int32_t iSize = 0;
CFX_ByteString token;
if (!GetNextToken(token)) {
- iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
return FALSE;
}
@@ -3991,7 +3991,7 @@ FX_BOOL CPDF_DataAvail::CheckCrossRef(IFX_DownloadHints* pHints)
m_CrossOffset.InsertAt(0, m_dwXRefOffset);
while (1) {
if (!GetNextToken(token)) {
- iSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ iSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
pHints->AddSegment(m_Pos, iSize);
m_docStatus = PDF_DATAAVAIL_CROSSREF_ITEM;
return FALSE;
@@ -4012,7 +4012,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints)
{
if (m_Pos < m_dwFileLen) {
FX_FILESIZE dwAppendPos = m_Pos + m_syntaxParser.SavePos();
- FX_INT32 iSize = (FX_INT32)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512);
+ int32_t iSize = (int32_t)(dwAppendPos + 512 > m_dwFileLen ? m_dwFileLen - dwAppendPos : 512);
if (!m_pFileAvail->IsDataAvail(dwAppendPos, iSize)) {
pHints->AddSegment(dwAppendPos, iSize);
return FALSE;
@@ -4028,9 +4028,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints)
}
FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
{
- FX_INT32 iTrailerSize = (FX_INT32)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ int32_t iTrailerSize = (int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) {
- FX_INT32 iSize = (FX_INT32)(m_Pos + iTrailerSize - m_dwTrailerOffset);
+ int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset);
CFX_BinaryBuf buf(iSize);
FX_LPBYTE pBuf = buf.GetBuffer();
if (!pBuf) {
@@ -4086,7 +4086,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
pHints->AddSegment(m_Pos, iTrailerSize);
return FALSE;
}
-FX_BOOL CPDF_DataAvail::CheckPage(FX_INT32 iPage, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints)
{
while (TRUE) {
switch (m_docStatus) {
@@ -4215,14 +4215,14 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP
pPage->Release();
return TRUE;
}
-FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage, FX_INT32 &iCount, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, int32_t iPage, int32_t &iCount, IFX_DownloadHints* pHints)
{
- FX_INT32 iSize = pageNodes.m_childNode.GetSize();
+ int32_t iSize = pageNodes.m_childNode.GetSize();
if (iSize <= 0 || iPage >= iSize) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- for (FX_INT32 i = 0; i < iSize; ++i) {
+ for (int32_t i = 0; i < iSize; ++i) {
CPDF_PageNode *pNode = (CPDF_PageNode*)pageNodes.m_childNode.GetAt(i);
if (!pNode) {
continue;
@@ -4259,7 +4259,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode &pageNodes, FX_INT32 iPage,
}
return TRUE;
}
-FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::LoadDocPage(int32_t iPage, IFX_DownloadHints* pHints)
{
if (m_pDocument->GetPageCount() <= iPage || m_pDocument->m_PageList.GetAt(iPage)) {
m_docStatus = PDF_DATAAVAIL_DONE;
@@ -4273,7 +4273,7 @@ FX_BOOL CPDF_DataAvail::LoadDocPage(FX_INT32 iPage, IFX_DownloadHints* pHints)
m_docStatus = PDF_DATAAVAIL_ERROR;
return TRUE;
}
- FX_INT32 iCount = -1;
+ int32_t iCount = -1;
return CheckPageNode(m_pageNodes, iPage, iCount, pHints);
}
FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints)
@@ -4361,7 +4361,7 @@ FX_BOOL CPDF_DataAvail::CheckLinearizedData(IFX_DownloadHints* pHints)
return m_bLinearedDataOK;
}
-FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage, IFX_DownloadHints* pHints)
{
if (!m_objs_array.GetSize()) {
m_objs_array.RemoveAll();
@@ -4391,7 +4391,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(FX_INT32 iPage, IFX_DownloadHints* pHint
return bRet;
}
}
-FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(FX_INT32 iPage, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::CheckLinearizedFirstPage(int32_t iPage, IFX_DownloadHints* pHints)
{
if (!m_bAnnotsLoad) {
if (!CheckPageAnnots(iPage, pHints)) {
@@ -4427,7 +4427,7 @@ FX_BOOL CPDF_DataAvail::HaveResourceAncestor(CPDF_Dictionary *pDict)
}
return HaveResourceAncestor(pParentDict);
}
-FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints)
+FX_BOOL CPDF_DataAvail::IsPageAvail(int32_t iPage, IFX_DownloadHints* pHints)
{
if (!m_pDocument) {
return FALSE;
@@ -4576,7 +4576,7 @@ void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE *pPos, FX_DWORD *pSiz
*pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset);
}
}
-FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints)
+int32_t CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints)
{
if (!m_pDocument) {
return PDFFORM_AVAIL;
@@ -4609,7 +4609,7 @@ FX_INT32 CPDF_DataAvail::IsFormAvail(IFX_DownloadHints *pHints)
}
void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum)
{
- FX_INT32 iNext = 0;
+ int32_t iNext = 0;
if (BinarySearch(dwObjNum, iNext)) {
return;
}
@@ -4617,15 +4617,15 @@ void CPDF_SortObjNumArray::AddObjNum(FX_DWORD dwObjNum)
}
FX_BOOL CPDF_SortObjNumArray::Find(FX_DWORD dwObjNum)
{
- FX_INT32 iNext = 0;
+ int32_t iNext = 0;
return BinarySearch(dwObjNum, iNext);
}
-FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext)
+FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, int32_t &iNext)
{
- FX_INT32 iLen = m_number_array.GetSize();
- FX_INT32 iLow = 0;
- FX_INT32 iHigh = iLen - 1;
- FX_INT32 iMid = 0;
+ int32_t iLen = m_number_array.GetSize();
+ int32_t iLow = 0;
+ int32_t iHigh = iLen - 1;
+ int32_t iMid = 0;
while (iLow <= iHigh) {
iMid = (iLow + iHigh) / 2;
if (m_number_array.GetAt(iMid) == value) {
@@ -4642,8 +4642,8 @@ FX_BOOL CPDF_SortObjNumArray::BinarySearch(FX_DWORD value, FX_INT32 &iNext)
}
CPDF_PageNode::~CPDF_PageNode()
{
- FX_INT32 iSize = m_childNode.GetSize();
- for (FX_INT32 i = 0; i < iSize; ++i) {
+ int32_t iSize = m_childNode.GetSize();
+ for (int32_t i = 0; i < iSize; ++i) {
CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
if (pNode) {
delete pNode;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index df154eae90..b02139db0f 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -60,7 +60,7 @@ void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ
pStart = NULL;
dwSize = 0;
type = PDFWORD_EOF;
- FX_BYTE ch;
+ uint8_t ch;
char chartype;
while (1) {
if (m_dwSize <= m_dwCurPos) {
@@ -322,7 +322,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig)
int dest_len = 0;
int i;
for (i = 0; i < src_len; i ++) {
- FX_BYTE ch = src_buf[i];
+ uint8_t ch = src_buf[i];
if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' ||
PDF_CharType[ch] == 'D') {
dest_len += 3;
@@ -337,7 +337,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig)
FX_LPSTR dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i ++) {
- FX_BYTE ch = src_buf[i];
+ uint8_t ch = src_buf[i];
if (ch >= 0x80 || PDF_CharType[ch] == 'W' || ch == '#' ||
PDF_CharType[ch] == 'D') {
dest_buf[dest_len++] = '#';