summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-06-11 12:17:45 -0700
committerTom Sepez <tsepez@chromium.org>2015-06-11 12:17:45 -0700
commit6581175666ba4e1eb2826142376cbfe4495c6e76 (patch)
tree38770d7cf709979b0d493a6ca0367a0cbc080736 /core/src/fpdfapi/fpdf_parser
parent05f11bcf48a630b53cac603538bb75f21ad4231d (diff)
downloadpdfium-6581175666ba4e1eb2826142376cbfe4495c6e76.tar.xz
Merge to XFA: Kill FXSYS_mem{cpy,cmp,set.move}{32,8}.
Only manual merge was core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp follwed by scripts. Original Review URL: https://codereview.chromium.org/1179693003. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1179953002.
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp80
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp14
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp22
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp2
6 files changed, 67 insertions, 67 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index bb490636a9..9736c3dc8e 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -49,7 +49,7 @@ FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu
continue;
}
if (ch == 'z') {
- FXSYS_memset32(dest_buf + dest_size, 0, 4);
+ FXSYS_memset(dest_buf + dest_size, 0, 4);
state = 0;
res = 0;
dest_size += 4;
@@ -159,9 +159,9 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& de
if (buf_left < copy_len) {
FX_DWORD delta = copy_len - buf_left;
copy_len = buf_left;
- FXSYS_memset8(dest_buf + dest_count + copy_len, '\0', delta);
+ FXSYS_memset(dest_buf + dest_count + copy_len, '\0', delta);
}
- FXSYS_memcpy32(dest_buf + dest_count, src_buf + i + 1, copy_len);
+ FXSYS_memcpy(dest_buf + dest_count, src_buf + i + 1, copy_len);
dest_count += src_buf[i] + 1;
i += src_buf[i] + 2;
} else if (src_buf[i] > 128) {
@@ -169,7 +169,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& de
if (i < src_size - 1) {
fill = src_buf[i + 1];
}
- FXSYS_memset8(dest_buf + dest_count, fill, 257 - src_buf[i]);
+ FXSYS_memset(dest_buf + dest_count, fill, 257 - src_buf[i]);
dest_count += 257 - src_buf[i];
i += 2;
} else {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index b4366ba277..43a5c5f170 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -47,8 +47,8 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, const uint8_t* password, FX_DWORD
CRYPT_MD5Generate(digest, copy_len, digest);
}
}
- FXSYS_memset32(key, 0, keylen);
- FXSYS_memcpy32(key, digest, copy_len);
+ FXSYS_memset(key, 0, keylen);
+ FXSYS_memcpy(key, digest, copy_len);
}
CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler()
{
@@ -285,7 +285,7 @@ void Revision6_Hash(const uint8_t* password, FX_DWORD size, const uint8_t* salt,
}
FX_Free(aes);
if (hash) {
- FXSYS_memcpy32(hash, input, 32);
+ FXSYS_memcpy(hash, input, 32);
}
}
FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size,
@@ -313,7 +313,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo
}
CRYPT_SHA256Finish(sha, digest);
}
- if (FXSYS_memcmp32(digest, pkey, 32) != 0) {
+ if (FXSYS_memcmp(digest, pkey, 32) != 0) {
return FALSE;
}
if (key == NULL) {
@@ -337,7 +337,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo
uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, digest, 32, FALSE);
uint8_t iv[16];
- FXSYS_memset32(iv, 0, 16);
+ FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESDecrypt(aes, key, ekey, 32);
CRYPT_AESSetKey(aes, 16, key, 32, FALSE);
@@ -347,12 +347,12 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* passwo
return FALSE;
}
uint8_t perms_buf[16];
- FXSYS_memset32(perms_buf, 0, sizeof(perms_buf));
+ FXSYS_memset(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, (const uint8_t*)perms, copy_len);
+ FXSYS_memcpy(perms_buf, (const uint8_t*)perms, copy_len);
uint8_t buf[16];
CRYPT_AESDecrypt(aes, buf, perms_buf, 16);
FX_Free(aes);
@@ -396,7 +396,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password,
}
uint8_t ukeybuf[32];
if (m_Revision == 2) {
- FXSYS_memcpy32(ukeybuf, defpasscode, 32);
+ FXSYS_memcpy(ukeybuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len);
} else {
uint8_t test[32], tmpkey[32];
@@ -404,9 +404,9 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password,
if (copy_len > (FX_DWORD)ukey.GetLength()) {
copy_len = ukey.GetLength();
}
- FXSYS_memset32(test, 0, sizeof(test));
- FXSYS_memset32(tmpkey, 0, sizeof(tmpkey));
- FXSYS_memcpy32(test, ukey.c_str(), copy_len);
+ FXSYS_memset(test, 0, sizeof(test));
+ FXSYS_memset(tmpkey, 0, sizeof(tmpkey));
+ FXSYS_memcpy(test, ukey.c_str(), copy_len);
for (int i = 19; i >= 0; i --) {
for (int j = 0; j < key_len; j ++) {
tmpkey[j] = key[j] ^ i;
@@ -422,9 +422,9 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password,
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(md5, ukeybuf);
- return FXSYS_memcmp32(test, ukeybuf, 16) == 0;
+ return FXSYS_memcmp(test, ukeybuf, 16) == 0;
}
- if (FXSYS_memcmp32((void*)ukey.c_str(), ukeybuf, 16) == 0) {
+ if (FXSYS_memcmp((void*)ukey.c_str(), ukeybuf, 16) == 0) {
return TRUE;
}
return FALSE;
@@ -449,25 +449,25 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owne
}
}
uint8_t enckey[32];
- FXSYS_memset32(enckey, 0, sizeof(enckey));
+ FXSYS_memset(enckey, 0, sizeof(enckey));
FX_DWORD copy_len = key_len;
if (copy_len > sizeof(digest)) {
copy_len = sizeof(digest);
}
- FXSYS_memcpy32(enckey, digest, copy_len);
+ FXSYS_memcpy(enckey, digest, copy_len);
int okeylen = okey.GetLength();
if (okeylen > 32) {
okeylen = 32;
}
uint8_t okeybuf[64];
- FXSYS_memset32(okeybuf, 0, sizeof(okeybuf));
- FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen);
+ FXSYS_memset(okeybuf, 0, sizeof(okeybuf));
+ FXSYS_memcpy(okeybuf, okey.c_str(), okeylen);
if (m_Revision == 2) {
CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len);
} else {
for (int i = 19; i >= 0; i --) {
uint8_t tempkey[32];
- FXSYS_memset32(tempkey, 0, sizeof(tempkey));
+ FXSYS_memset(tempkey, 0, sizeof(tempkey));
for (int j = 0; j < m_KeyLen; j ++) {
tempkey[j] = enckey[j] ^ i;
}
@@ -538,7 +538,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
}
}
uint8_t enckey[32];
- FXSYS_memcpy32(enckey, digest, key_len);
+ FXSYS_memcpy(enckey, digest, key_len);
for (i = 0; i < 32; i ++) {
passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size];
}
@@ -557,7 +557,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray);
if (m_Revision < 3) {
uint8_t tempbuf[32];
- FXSYS_memcpy32(tempbuf, defpasscode, 32);
+ FXSYS_memcpy(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
pEncryptDict->SetAtString(FX_BSTRC("U"), CFX_ByteString(tempbuf, 32));
} else {
@@ -613,7 +613,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
}
CRYPT_SHA256Finish(sha, digest1);
}
- FXSYS_memcpy32(digest1 + 32, digest, 16);
+ FXSYS_memcpy(digest1 + 32, digest, 16);
pEncryptDict->SetAtString(bOwner ? FX_BSTRC("O") : FX_BSTRC("U"), CFX_ByteString(digest1, 48));
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest + 8, (bOwner ? (const uint8_t*)ukey : NULL), digest1);
@@ -629,7 +629,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, digest1, 32, TRUE);
uint8_t iv[16];
- FXSYS_memset32(iv, 0, 16);
+ FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, digest1, key, 32);
FX_Free(aes);
@@ -654,7 +654,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict
uint8_t* aes = FX_Alloc(uint8_t, 2048);
CRYPT_AESSetKey(aes, 16, key, 32, TRUE);
uint8_t iv[16], buf1[16];
- FXSYS_memset32(iv, 0, 16);
+ FXSYS_memset(iv, 0, 16);
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, buf1, buf, 16);
FX_Free(aes);
@@ -664,23 +664,23 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F
uint8_t* dest_buf, FX_DWORD& dest_size)
{
if (m_Cipher == FXCIPHER_NONE) {
- FXSYS_memcpy32(dest_buf, src_buf, src_size);
+ FXSYS_memcpy(dest_buf, src_buf, src_size);
return;
}
uint8_t realkey[16];
int realkeylen = 16;
if (m_Cipher != FXCIPHER_AES || m_KeyLen != 32) {
uint8_t key1[32];
- FXSYS_memcpy32(key1, m_EncryptKey, m_KeyLen);
+ FXSYS_memcpy(key1, m_EncryptKey, m_KeyLen);
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);
+ FXSYS_memcpy(key1 + m_KeyLen, &objnum, 3);
+ FXSYS_memcpy(key1 + m_KeyLen + 3, &gennum, 2);
if (m_Cipher == FXCIPHER_AES) {
- FXSYS_memcpy32(key1 + m_KeyLen + 5, "sAlT", 4);
+ FXSYS_memcpy(key1 + m_KeyLen + 5, "sAlT", 4);
}
CRYPT_MD5Generate(key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey);
realkeylen = m_KeyLen + 5;
@@ -696,12 +696,12 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F
iv[i] = (uint8_t)rand();
}
CRYPT_AESSetIV(m_pAESContext, iv);
- FXSYS_memcpy32(dest_buf, iv, 16);
+ FXSYS_memcpy(dest_buf, iv, 16);
int nblocks = src_size / 16;
CRYPT_AESEncrypt(m_pAESContext, dest_buf + 16, src_buf, nblocks * 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);
+ FXSYS_memcpy(padding, src_buf + nblocks * 16, src_size % 16);
+ FXSYS_memset(padding + src_size % 16, 16 - src_size % 16, 16 - src_size % 16);
CRYPT_AESEncrypt(m_pAESContext, dest_buf + nblocks * 16 + 16, padding, 16);
dest_size = 32 + nblocks * 16;
} else {
@@ -713,7 +713,7 @@ void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, F
} else {
ASSERT(dest_size == src_size);
if (dest_buf != src_buf) {
- FXSYS_memcpy32(dest_buf, src_buf, src_size);
+ FXSYS_memcpy(dest_buf, src_buf, src_size);
}
CRYPT_ArcFourCryptBlock(dest_buf, dest_size, realkey, realkeylen);
}
@@ -743,11 +743,11 @@ void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, F
return pContext;
}
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);
+ FXSYS_memcpy(key1, m_EncryptKey, m_KeyLen);
+ FXSYS_memcpy(key1 + m_KeyLen, &objnum, 3);
+ FXSYS_memcpy(key1 + m_KeyLen + 3, &gennum, 2);
if (m_Cipher == FXCIPHER_AES) {
- FXSYS_memcpy32(key1 + m_KeyLen + 5, "sAlT", 4);
+ FXSYS_memcpy(key1 + m_KeyLen + 5, "sAlT", 4);
}
uint8_t realkey[16];
CRYPT_MD5Generate(key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey);
@@ -799,7 +799,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* sr
if (copy_size > src_left) {
copy_size = src_left;
}
- FXSYS_memcpy32(pContext->m_Block + pContext->m_BlockOffset, src_buf + src_off, copy_size);
+ FXSYS_memcpy(pContext->m_Block + pContext->m_BlockOffset, src_buf + src_off, copy_size);
src_off += copy_size;
src_left -= copy_size;
pContext->m_BlockOffset += copy_size;
@@ -845,7 +845,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& de
dest_buf.AppendBlock(block_buf, 16);
pContext->m_BlockOffset = 0;
}
- FXSYS_memset8(pContext->m_Block + pContext->m_BlockOffset, (uint8_t)(16 - pContext->m_BlockOffset), 16 - pContext->m_BlockOffset);
+ FXSYS_memset(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) {
@@ -876,7 +876,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec
return FALSE;
}
if (m_Cipher != FXCIPHER_NONE) {
- FXSYS_memcpy32(m_EncryptKey, key, m_KeyLen);
+ FXSYS_memcpy(m_EncryptKey, key, m_KeyLen);
}
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
@@ -909,7 +909,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int key
}
m_Cipher = cipher;
m_KeyLen = keylen;
- FXSYS_memcpy32(m_EncryptKey, key, keylen);
+ FXSYS_memcpy(m_EncryptKey, key, keylen);
if (m_Cipher == FXCIPHER_AES) {
m_pAESContext = FX_Alloc(uint8_t, 2048);
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
index f0cabe5412..c00b193413 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
@@ -255,7 +255,7 @@ FX_DWORD CPDF_StreamFilter::ReadLeftOver(uint8_t* buffer, FX_DWORD buf_size)
if (read_size > buf_size) {
read_size = buf_size;
}
- FXSYS_memcpy32(buffer, m_pBuffer->GetBuffer() + m_BufOffset, read_size);
+ FXSYS_memcpy(buffer, m_pBuffer->GetBuffer() + m_BufOffset, read_size);
m_BufOffset += read_size;
if (m_BufOffset == (FX_DWORD)m_pBuffer->GetSize()) {
delete m_pBuffer;
@@ -548,7 +548,7 @@ void CPDF_PredictorFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size,
if (read_size > src_size) {
read_size = src_size;
}
- FXSYS_memcpy32(m_pCurLine + m_LineInSize, src_buf, read_size);
+ FXSYS_memcpy(m_pCurLine + m_LineInSize, src_buf, read_size);
m_LineInSize += read_size;
if (m_LineInSize < m_Pitch) {
break;
@@ -696,7 +696,7 @@ void CPDF_RunLenFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CF
break;
case 2: {
dest_buf.AppendBlock(NULL, m_Count);
- FXSYS_memset8(dest_buf.GetBuffer() + dest_buf.GetSize() - m_Count, byte, m_Count);
+ FXSYS_memset(dest_buf.GetBuffer() + dest_buf.GetSize() - m_Count, byte, m_Count);
m_State = 0;
break;
}
@@ -805,8 +805,8 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign,
m_Pitch = (m_nColumns + 7) / 8;
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);
+ FXSYS_memset(m_pScanlineBuf, 0xff, m_Pitch);
+ FXSYS_memset(m_pRefBuf, 0xff, m_Pitch);
m_iRow = 0;
m_InputBitPos = 0;
return TRUE;
@@ -851,13 +851,13 @@ void CPDF_FaxFilter::ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int&
return;
}
int start_bitpos = bitpos;
- FXSYS_memset8(m_pScanlineBuf, 0xff, m_Pitch);
+ FXSYS_memset(m_pScanlineBuf, 0xff, m_Pitch);
if (!ReadLine(src_buf, bitsize, bitpos)) {
bitpos = start_bitpos;
return;
}
if (m_Encoding) {
- FXSYS_memcpy32(m_pRefBuf, m_pScanlineBuf, m_Pitch);
+ FXSYS_memcpy(m_pRefBuf, m_pScanlineBuf, m_Pitch);
}
if (m_bBlack) {
for (int i = 0; i < m_Pitch; i ++) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 8533859bef..cc2cc6f4ad 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -122,7 +122,7 @@ int CPDF_Object::GetInteger() const
case PDFOBJ_REFERENCE: {
CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
PARSE_CONTEXT context;
- FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT));
+ FXSYS_memset(&context, 0, sizeof(PARSE_CONTEXT));
if (pRef->m_pObjList == NULL) {
return 0;
}
@@ -898,7 +898,7 @@ void CPDF_Stream::InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDi
m_GenNum = (FX_DWORD) - 1;
m_pDataBuf = FX_Alloc(uint8_t, size);
if (pData) {
- FXSYS_memcpy32(m_pDataBuf, pData, size);
+ FXSYS_memcpy(m_pDataBuf, pData, size);
}
m_dwSize = size;
if (m_pDict) {
@@ -920,7 +920,7 @@ void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompress
} else {
m_pDataBuf = FX_Alloc(uint8_t, size);
if (pData) {
- FXSYS_memcpy32(m_pDataBuf, pData, size);
+ FXSYS_memcpy(m_pDataBuf, pData, size);
}
}
m_dwSize = size;
@@ -939,7 +939,7 @@ FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size
return m_pFile->ReadBlock(buf, m_FileOffset + offset, size);
}
if (m_pDataBuf) {
- FXSYS_memcpy32(buf, m_pDataBuf + offset, size);
+ FXSYS_memcpy(buf, m_pDataBuf + offset, size);
}
return TRUE;
}
@@ -982,7 +982,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
FX_DWORD actualSize = size > 1024 ? 1024 : size;
m_pFile->ReadBlock(srcBuf, srcOffset, actualSize);
pOther->m_pFile->ReadBlock(destBuf, destOffset, actualSize);
- if (FXSYS_memcmp32(srcBuf, destBuf, actualSize) != 0) {
+ if (FXSYS_memcmp(srcBuf, destBuf, actualSize) != 0) {
return FALSE;
}
size -= actualSize;
@@ -1011,9 +1011,9 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
uint8_t srcBuf[1024];
FX_DWORD size = m_dwSize;
while (size > 0) {
- FX_DWORD actualSize = size > 1024 ? 1024 : size;
- m_pFile->ReadBlock(srcBuf, offset, actualSize);
- if (FXSYS_memcmp32(srcBuf, pBuf, actualSize) != 0) {
+ FX_DWORD actualSize = std::min(size, 1024U);
+ pFile->ReadBlock(srcBuf, offset, actualSize);
+ if (FXSYS_memcmp(srcBuf, pBuf, actualSize) != 0) {
return FALSE;
}
pBuf += actualSize;
@@ -1022,7 +1022,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
}
return TRUE;
}
- return FXSYS_memcmp32(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0;
+ return FXSYS_memcmp(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0;
}
CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const
{
@@ -1166,7 +1166,7 @@ uint8_t* CPDF_StreamAcc::DetachData()
return p;
}
uint8_t* p = FX_Alloc(uint8_t, m_dwSize);
- FXSYS_memcpy32(p, m_pData, m_dwSize);
+ FXSYS_memcpy(p, m_pData, m_dwSize);
return p;
}
void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum)
@@ -1235,7 +1235,7 @@ int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum)
}
if (m_pParser) {
PARSE_CONTEXT context;
- FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT));
+ FXSYS_memset(&context, 0, sizeof(PARSE_CONTEXT));
context.m_Flags = PDFPARSE_TYPEONLY;
return (int)(uintptr_t)m_pParser->ParseIndirectObject(this, objnum, &context);
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index f4fa8ff499..401fc0d5f4 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -1028,7 +1028,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
m_pTrailer = (CPDF_Dictionary*)pStream->GetDict()->Clone();
m_CrossRef.SetSize(size);
if (m_V5Type.SetSize(size)) {
- FXSYS_memset32(m_V5Type.GetData(), 0, size);
+ FXSYS_memset(m_V5Type.GetData(), 0, size);
}
} else {
m_Trailers.Add((CPDF_Dictionary*)pStream->GetDict()->Clone());
@@ -1302,7 +1302,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD
size = nextoff - thisoff;
}
pBuffer = FX_Alloc(uint8_t, size);
- FXSYS_memcpy32(pBuffer, pData + thisoff + offset, size);
+ FXSYS_memcpy(pBuffer, pData + thisoff + offset, size);
return;
}
n --;
@@ -2449,7 +2449,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT
m_Pos = pos.ValueOrDie();
}
GetNextWord();
- if (m_WordSize < 9 || FXSYS_memcmp32(m_WordBuffer, "endstream", 9)) {
+ if (m_WordSize < 9 || FXSYS_memcmp(m_WordBuffer, "endstream", 9)) {
m_Pos = StreamStartPos;
FX_FILESIZE offset = FindTag(FX_BSTRC("endstream"), 0);
if (offset >= 0) {
@@ -2500,7 +2500,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT
}
StreamStartPos = m_Pos;
GetNextWord();
- if (m_WordSize == 6 && 0 == FXSYS_memcmp32(m_WordBuffer, "endobj", 6)) {
+ if (m_WordSize == 6 && 0 == FXSYS_memcmp(m_WordBuffer, "endobj", 6)) {
m_Pos = StreamStartPos;
}
return pStream;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 61134f5df4..0bb0b51907 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -198,7 +198,7 @@ FX_BOOL CPDF_SimpleParser::SearchToken(const CFX_ByteStringC& token)
{
int token_len = token.GetLength();
while (m_dwCurPos < m_dwSize - token_len) {
- if (FXSYS_memcmp32(m_pData + m_dwCurPos, token.GetPtr(), token_len) == 0) {
+ if (FXSYS_memcmp(m_pData + m_dwCurPos, token.GetPtr(), token_len) == 0) {
break;
}
m_dwCurPos ++;