summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/filters_int.h32
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp50
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp112
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp42
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp91
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp84
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp16
9 files changed, 220 insertions, 217 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/filters_int.h b/core/src/fpdfapi/fpdf_parser/filters_int.h
index 6652cc0ccc..38dcb171f5 100644
--- a/core/src/fpdfapi/fpdf_parser/filters_int.h
+++ b/core/src/fpdfapi/fpdf_parser/filters_int.h
@@ -12,10 +12,10 @@ class CPDF_DecryptFilter : public CFX_DataFilter
public:
CPDF_DecryptFilter(CPDF_CryptoHandler* pCryptoHandler, FX_DWORD objnum, FX_DWORD gennum);
virtual ~CPDF_DecryptFilter();
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf);
CPDF_CryptoHandler* m_pCryptoHandler;
- FX_LPVOID m_pContext;
+ void* m_pContext;
FX_DWORD m_ObjNum, m_GenNum;
};
class CPDF_FlateFilter : public CFX_DataFilter
@@ -23,7 +23,7 @@ class CPDF_FlateFilter : public CFX_DataFilter
public:
CPDF_FlateFilter();
virtual ~CPDF_FlateFilter();
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
void* m_pContext;
uint8_t m_DestBuffer[FPDF_FILTER_BUFFER_SIZE];
@@ -33,7 +33,7 @@ class CPDF_LzwFilter : public CFX_DataFilter
public:
CPDF_LzwFilter(FX_BOOL bEarlyChange);
virtual ~CPDF_LzwFilter() {}
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
FX_BOOL m_bEarlyChange;
FX_DWORD m_CodeArray[5021];
@@ -52,11 +52,12 @@ class CPDF_PredictorFilter : public CFX_DataFilter
public:
CPDF_PredictorFilter(int predictor, int colors, int bpc, int cols);
virtual ~CPDF_PredictorFilter();
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
FX_BOOL m_bTiff;
FX_DWORD m_Pitch, m_Bpp;
- FX_LPBYTE m_pRefLine, m_pCurLine;
+ uint8_t* m_pRefLine;
+ uint8_t* m_pCurLine;
FX_DWORD m_iLine, m_LineInSize;
};
class CPDF_AsciiHexFilter : public CFX_DataFilter
@@ -64,7 +65,7 @@ class CPDF_AsciiHexFilter : public CFX_DataFilter
public:
CPDF_AsciiHexFilter();
virtual ~CPDF_AsciiHexFilter() {}
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
int m_State;
int m_FirstDigit;
@@ -74,7 +75,7 @@ class CPDF_Ascii85Filter : public CFX_DataFilter
public:
CPDF_Ascii85Filter();
virtual ~CPDF_Ascii85Filter() {}
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
int m_State;
int m_CharCount;
@@ -85,7 +86,7 @@ class CPDF_RunLenFilter : public CFX_DataFilter
public:
CPDF_RunLenFilter();
virtual ~CPDF_RunLenFilter() {}
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
int m_State;
FX_DWORD m_Count;
@@ -95,11 +96,11 @@ class CPDF_JpegFilter : public CFX_DataFilter
public:
CPDF_JpegFilter();
virtual ~CPDF_JpegFilter();
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf) {}
void* m_pContext;
CFX_BinaryBuf m_InputBuf;
- FX_LPBYTE m_pScanline;
+ uint8_t* m_pScanline;
int m_Pitch, m_Height, m_Width, m_nComps, m_iLine;
FX_BOOL m_bGotHeader;
};
@@ -109,16 +110,17 @@ public:
CPDF_FaxFilter();
virtual ~CPDF_FaxFilter();
FX_BOOL Initialize(int Encoding, int bEndOfLine, int bByteAlign, int bBlack, int nRows, int nColumns);
- virtual void v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
+ virtual void v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf);
virtual void v_FilterFinish(CFX_BinaryBuf& dest_buf);
int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack;
int m_nRows, m_nColumns, m_Pitch, m_iRow;
- FX_LPBYTE m_pScanlineBuf, m_pRefBuf;
+ uint8_t* m_pScanlineBuf;
+ uint8_t* m_pRefBuf;
CFX_BinaryBuf m_InputBuf;
int m_InputBitPos;
- void ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
+ void ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
CFX_BinaryBuf& dest_buf);
- FX_BOOL ReadLine(FX_LPCBYTE src_buf, int bitsize, int& bitpos);
+ FX_BOOL ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos);
};
#endif // CORE_SRC_FPDFAPI_FPDF_PARSER_FILTERS_INT_H_
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index b1fde0be71..bb490636a9 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -9,7 +9,7 @@
#include "../../../include/fxcodec/fx_codec.h"
#include <limits.h>
#define _STREAM_MAX_SIZE_ 20 * 1024 * 1024
-FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
dest_size = 0;
dest_buf = NULL;
@@ -82,7 +82,7 @@ FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
}
return pos;
}
-FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
FX_DWORD i;
for (i = 0; i < src_size; i ++)
@@ -122,7 +122,7 @@ FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_b
}
return i;
}
-FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
FX_DWORD i = 0;
FX_DWORD old;
@@ -182,7 +182,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& d
}
return ret;
}
-ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
const CPDF_Dictionary* pParams)
{
int K = 0;
@@ -228,7 +228,7 @@ static FX_BOOL CheckFlateDecodeParams(int Colors, int BitsPerComponent, int Colu
}
return TRUE;
}
-ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, int width, int height,
+ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height,
int nComps, int bpc, const CPDF_Dictionary* pParams)
{
int predictor = 0;
@@ -246,7 +246,7 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD
nComps, bpc, predictor, Colors, BitsPerComponent, Columns);
}
FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, CPDF_Dictionary* pParams,
- FX_DWORD estimated_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+ FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
int predictor = 0;
FX_BOOL bEarlyChange = TRUE;
@@ -265,8 +265,8 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD
bEarlyChange, predictor, Colors, BitsPerComponent, Columns, estimated_size,
dest_buf, dest_size);
}
-FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
- FX_LPBYTE& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding,
+FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
+ uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding,
CPDF_Dictionary*& pImageParms, FX_DWORD last_estimated_size, FX_BOOL bImageAcc)
{
@@ -295,19 +295,19 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction
DecoderList.Add(pDecoder->GetConstString());
ParamList.Add(pParams ? pParams->GetDict() : NULL);
}
- FX_LPBYTE last_buf = (FX_LPBYTE)src_buf;
+ uint8_t* last_buf = (uint8_t*)src_buf;
FX_DWORD last_size = src_size;
for (int i = 0; i < DecoderList.GetSize(); i ++) {
int estimated_size = i == DecoderList.GetSize() - 1 ? last_estimated_size : 0;
CFX_ByteString decoder = DecoderList[i];
CPDF_Dictionary* pParam = (CPDF_Dictionary*)ParamList[i];
- FX_LPBYTE new_buf = NULL;
+ uint8_t* new_buf = NULL;
FX_DWORD new_size = (FX_DWORD) - 1;
int offset = -1;
if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
if (bImageAcc && i == DecoderList.GetSize() - 1) {
ImageEncoding = FX_BSTRC("FlateDecode");
- dest_buf = (FX_LPBYTE)last_buf;
+ dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
return TRUE;
@@ -323,7 +323,7 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction
} else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) {
if (bImageAcc && i == DecoderList.GetSize() - 1) {
ImageEncoding = FX_BSTRC("RunLengthDecode");
- dest_buf = (FX_LPBYTE)last_buf;
+ dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
return TRUE;
@@ -339,7 +339,7 @@ FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Diction
}
ImageEncoding = decoder;
pImageParms = pParam;
- dest_buf = (FX_LPBYTE)last_buf;
+ dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
return TRUE;
}
@@ -386,7 +386,7 @@ extern const FX_WORD PDFDocEncoding[256] = {
0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9,
0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
};
-CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap* pCharMap)
+CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len, CFX_CharMap* pCharMap)
{
CFX_WideString result;
if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) || (src_data[0] == 0xff && src_data[1] == 0xfe))) {
@@ -398,8 +398,8 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap
if (src_data[0] == 0xff) {
bBE = !src_data[2];
}
- FX_LPWSTR dest_buf = result.GetBuffer(max_chars);
- FX_LPCBYTE uni_str = src_data + 2;
+ FX_WCHAR* dest_buf = result.GetBuffer(max_chars);
+ const uint8_t* uni_str = src_data + 2;
int dest_pos = 0;
for (FX_DWORD i = 0; i < max_chars * 2; i += 2) {
FX_WORD unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1]) : (uni_str[i + 1] << 8 | uni_str[i]);
@@ -418,24 +418,24 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap
}
result.ReleaseBuffer(dest_pos);
} else if (pCharMap == NULL) {
- FX_LPWSTR dest_buf = result.GetBuffer(src_len);
+ FX_WCHAR* dest_buf = result.GetBuffer(src_len);
for (FX_DWORD i = 0; i < src_len; i ++) {
dest_buf[i] = PDFDocEncoding[src_data[i]];
}
result.ReleaseBuffer(src_len);
} else {
- return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((FX_LPCSTR)src_data, src_len));
+ return (*pCharMap->m_GetWideString)(pCharMap, CFX_ByteString((const FX_CHAR*)src_data, src_len));
}
return result;
}
-CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap)
+CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len, CFX_CharMap* pCharMap)
{
if (len == -1) {
len = FXSYS_wcslen(pString);
}
CFX_ByteString result;
if (pCharMap == NULL) {
- FX_LPSTR dest_buf1 = result.GetBuffer(len);
+ FX_CHAR* dest_buf1 = result.GetBuffer(len);
int i;
for (i = 0; i < len; i ++) {
int code;
@@ -462,7 +462,7 @@ CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap
int encLen = len * 2 + 2;
- FX_LPBYTE dest_buf2 = (FX_LPBYTE)result.GetBuffer(encLen);
+ uint8_t* dest_buf2 = (uint8_t*)result.GetBuffer(encLen);
dest_buf2[0] = 0xfe;
dest_buf2[1] = 0xff;
dest_buf2 += 2;
@@ -503,22 +503,22 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex)
result.AppendChar(')');
return result.GetByteString();
}
-void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size);
}
}
-void FlateEncode(FX_LPCBYTE src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns,
- FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+void FlateEncode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns,
+ uint8_t*& dest_buf, FX_DWORD& dest_size)
{
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors, BitsPerComponent, Columns, dest_buf, dest_size);
}
}
-FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
+FX_DWORD FlateDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size)
{
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index f2643694ec..bd15c7587e 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -343,7 +343,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const
{
{
CPDF_Object* pObj;
- if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pObj)) {
+ if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) {
bForm = pObj->GetType() == PDFOBJ_STREAM &&
((CPDF_Stream*)pObj)->GetDict()->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Form");
return TRUE;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 4ca97fe9e8..973a14e33b 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -13,8 +13,8 @@ const uint8_t defpasscode[32] = {
0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80,
0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a
};
-void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pass_size,
- FX_LPBYTE key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray)
+void CalcEncryptKey(CPDF_Dictionary* pEncrypt, const uint8_t* password, FX_DWORD pass_size,
+ uint8_t* key, int keylen, FX_BOOL bIgnoreMeta, CPDF_Array* pIdArray)
{
int revision = pEncrypt->GetInteger(FX_BSTRC("R"));
uint8_t passcode[32];
@@ -25,16 +25,16 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, passcode, 32);
CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O"));
- CRYPT_MD5Update(md5, (FX_LPBYTE)okey.c_str(), okey.GetLength());
+ CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength());
FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P"));
- CRYPT_MD5Update(md5, (FX_LPBYTE)&perm, 4);
+ CRYPT_MD5Update(md5, (uint8_t*)&perm, 4);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetString(0);
- CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength());
+ CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) {
FX_DWORD tag = (FX_DWORD) - 1;
- CRYPT_MD5Update(md5, (FX_LPBYTE)&tag, 4);
+ CRYPT_MD5Update(md5, (uint8_t*)&tag, 4);
}
uint8_t digest[16];
CRYPT_MD5Finish(md5, digest);
@@ -189,7 +189,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, FX
return TRUE;
return TRUE;
}
-FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buffer, int& keylen)
+FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, const uint8_t*& buffer, int& keylen)
{
cipher = m_Cipher;
buffer = m_EncryptKey;
@@ -203,7 +203,7 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher, FX_LPCBYTE& buff
| ( (uint64_t) (b)[(i) + 2] << 8 ) \
| ( (uint64_t) (b)[(i) + 3] )); \
}
-int BigOrder64BitsMod3(FX_LPBYTE data)
+int BigOrder64BitsMod3(uint8_t* data)
{
uint64_t ret = 0;
for (int i = 0; i < 4; ++i) {
@@ -215,7 +215,7 @@ int BigOrder64BitsMod3(FX_LPBYTE data)
}
return (int)ret;
}
-void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCBYTE vector, FX_LPBYTE hash)
+void Revision6_Hash(const uint8_t* password, FX_DWORD size, const uint8_t* salt, const uint8_t* vector, uint8_t* hash)
{
int iBlockSize = 32;
uint8_t sha[128];
@@ -228,14 +228,14 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB
uint8_t digest[32];
CRYPT_SHA256Finish(sha, digest);
CFX_ByteTextBuf buf;
- FX_LPBYTE input = digest;
- FX_LPBYTE key = input;
- FX_LPBYTE iv = input + 16;
- FX_LPBYTE E = buf.GetBuffer();
+ uint8_t* input = digest;
+ uint8_t* key = input;
+ uint8_t* iv = input + 16;
+ uint8_t* E = buf.GetBuffer();
int iBufLen = buf.GetLength();
CFX_ByteTextBuf interDigest;
int i = 0;
- FX_LPBYTE aes = FX_Alloc(uint8_t, 2048);
+ uint8_t* aes = FX_Alloc(uint8_t, 2048);
while (i < 64 || i < E[iBufLen - 1] + 32) {
int iRoundSize = size + iBlockSize;
if (vector) {
@@ -288,8 +288,8 @@ void Revision6_Hash(FX_LPCBYTE password, FX_DWORD size, FX_LPCBYTE salt, FX_LPCB
FXSYS_memcpy32(hash, input, 32);
}
}
-FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password, FX_DWORD size,
- FX_BOOL bOwner, FX_LPBYTE key)
+FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(const uint8_t* password, FX_DWORD size,
+ FX_BOOL bOwner, uint8_t* key)
{
CFX_ByteString okey = m_pEncryptDict ? m_pEncryptDict->GetString(FX_BSTRC("O")) : CFX_ByteString();
if (okey.GetLength() < 48) {
@@ -299,11 +299,11 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password,
if (ukey.GetLength() < 48) {
return FALSE;
}
- FX_LPCBYTE pkey = bOwner ? (FX_LPCBYTE)okey : (FX_LPCBYTE)ukey;
+ const uint8_t* pkey = bOwner ? (const uint8_t*)okey : (const uint8_t*)ukey;
uint8_t sha[128];
uint8_t digest[32];
if (m_Revision >= 6) {
- Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 32, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest);
+ Revision6_Hash(password, size, (const uint8_t*)pkey + 32, (bOwner ? (const uint8_t*)ukey : NULL), digest);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
@@ -320,7 +320,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password,
return TRUE;
}
if (m_Revision >= 6) {
- Revision6_Hash(password, size, (FX_LPCBYTE)pkey + 40, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest);
+ Revision6_Hash(password, size, (const uint8_t*)pkey + 40, (bOwner ? (const uint8_t*)ukey : NULL), digest);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
@@ -352,7 +352,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password,
if (copy_len > (FX_DWORD)perms.GetLength()) {
copy_len = perms.GetLength();
}
- FXSYS_memcpy32(perms_buf, (FX_LPCBYTE)perms, copy_len);
+ FXSYS_memcpy32(perms_buf, (const uint8_t*)perms, copy_len);
uint8_t buf[16];
CRYPT_AESDecrypt(aes, buf, perms_buf, 16);
FX_Free(aes);
@@ -367,11 +367,11 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(FX_LPCBYTE password,
}
return TRUE;
}
-int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD pass_size, FX_BOOL bOwner, FX_LPBYTE key)
+int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD pass_size, FX_BOOL bOwner, uint8_t* key)
{
return CheckPassword(password, pass_size, bOwner, key, m_KeyLen);
}
-int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPBYTE key, int32_t key_len)
+int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, uint8_t* key, int32_t key_len)
{
if (m_Revision >= 5) {
return AES256_CheckPassword(password, size, bOwner, key);
@@ -385,8 +385,8 @@ int CPDF_StandardSecurityHandler::CheckPassword(FX_LPCBYTE password, FX_DWORD si
}
return CheckUserPassword(password, size, FALSE, key, key_len) || CheckUserPassword(password, size, TRUE, key, key_len);
}
-FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_DWORD pass_size,
- FX_BOOL bIgnoreEncryptMeta, FX_LPBYTE key, int32_t key_len)
+FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(const uint8_t* password, FX_DWORD pass_size,
+ FX_BOOL bIgnoreEncryptMeta, uint8_t* key, int32_t key_len)
{
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len, bIgnoreEncryptMeta,
m_pParser->GetIDArray());
@@ -419,21 +419,21 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_
CPDF_Array* pIdArray = m_pParser->GetIDArray();
if (pIdArray) {
CFX_ByteString id = pIdArray->GetString(0);
- CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength());
+ CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(md5, ukeybuf);
return FXSYS_memcmp32(test, ukeybuf, 16) == 0;
}
- if (FXSYS_memcmp32((FX_LPVOID)ukey.c_str(), ukeybuf, 16) == 0) {
+ if (FXSYS_memcmp32((void*)ukey.c_str(), ukeybuf, 16) == 0) {
return TRUE;
}
return FALSE;
}
-CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size)
+CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size)
{
return GetUserPassword(owner_pass, pass_size, m_KeyLen);
}
-CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pass, FX_DWORD pass_size, int32_t key_len)
+CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(const uint8_t* owner_pass, FX_DWORD pass_size, int32_t key_len)
{
CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O"));
uint8_t passcode[32];
@@ -480,8 +480,8 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa
}
return CFX_ByteString(okeybuf, len);
}
-FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(FX_LPCBYTE password, FX_DWORD pass_size,
- FX_LPBYTE key, int32_t key_len)
+FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(const uint8_t* password, FX_DWORD pass_size,
+ uint8_t* key, int32_t key_len)
{
CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
if (CheckUserPassword(user_pass, user_pass.GetLength(), FALSE, key, key_len)) {
@@ -498,8 +498,8 @@ CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler()
return new CPDF_StandardSecurityHandler;
}
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray,
- FX_LPCBYTE user_pass, FX_DWORD user_size,
- FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type)
+ const uint8_t* user_pass, FX_DWORD user_size,
+ const uint8_t* owner_pass, FX_DWORD owner_size, FX_BOOL bDefault, FX_DWORD type)
{
int cipher = 0, key_len = 0;
if (!LoadDict(pEncryptDict, type, cipher, key_len)) {
@@ -554,7 +554,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
}
pEncryptDict->SetAtString(FX_BSTRC("O"), CFX_ByteString(passcode, 32));
}
- CalcEncryptKey(m_pEncryptDict, (FX_LPBYTE)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray);
+ CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey, key_len, FALSE, pIdArray);
if (m_Revision < 3) {
uint8_t tempbuf[32];
FXSYS_memcpy32(tempbuf, defpasscode, 32);
@@ -566,7 +566,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
CRYPT_MD5Update(md5, defpasscode, 32);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetString(0);
- CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength());
+ CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
uint8_t digest[32];
CRYPT_MD5Finish(md5, digest);
@@ -583,16 +583,16 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_
}
}
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray,
- FX_LPCBYTE user_pass, FX_DWORD user_size,
- FX_LPCBYTE owner_pass, FX_DWORD owner_size, FX_DWORD type)
+ const uint8_t* user_pass, FX_DWORD user_size,
+ const uint8_t* owner_pass, FX_DWORD owner_size, FX_DWORD type)
{
OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size, TRUE, type);
}
-void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, FX_LPCBYTE user_pass, FX_DWORD user_size, FX_DWORD type)
+void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, const uint8_t* user_pass, FX_DWORD user_size, FX_DWORD type)
{
OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type);
}
-void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, FX_LPCBYTE password, FX_DWORD size, FX_BOOL bOwner, FX_LPCBYTE key)
+void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, FX_DWORD size, FX_BOOL bOwner, const uint8_t* key)
{
uint8_t sha[128];
CRYPT_SHA1Start(sha);
@@ -603,7 +603,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U"));
uint8_t digest1[48];
if (m_Revision >= 6) {
- Revision6_Hash(password, size, digest, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1);
+ Revision6_Hash(password, size, digest, (bOwner ? (const uint8_t*)ukey : NULL), digest1);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
@@ -616,7 +616,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
FXSYS_memcpy32(digest1 + 32, digest, 16);
pEncryptDict->SetAtString(bOwner ? FX_BSTRC("O") : FX_BSTRC("U"), CFX_ByteString(digest1, 48));
if (m_Revision >= 6) {
- Revision6_Hash(password, size, digest + 8, (bOwner ? (FX_LPCBYTE)ukey : NULL), digest1);
+ Revision6_Hash(password, size, digest + 8, (bOwner ? (const uint8_t*)ukey : NULL), digest1);
} else {
CRYPT_SHA256Start(sha);
CRYPT_SHA256Update(sha, password, size);
@@ -636,7 +636,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptD
pEncryptDict->SetAtString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE"), CFX_ByteString(digest1, 32));
}
void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, FX_DWORD permissions,
- FX_BOOL bEncryptMetadata, FX_LPCBYTE key)
+ FX_BOOL bEncryptMetadata, const uint8_t* key)
{
uint8_t buf[16];
buf[0] = (uint8_t)permissions;
@@ -660,8 +660,8 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict
FX_Free(aes);
pEncryptDict->SetAtString(FX_BSTRC("Perms"), CFX_ByteString(buf1, 16));
}
-void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, FX_LPCBYTE src_buf, FX_DWORD src_size,
- FX_LPBYTE dest_buf, FX_DWORD& dest_size)
+void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt, FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
+ uint8_t* dest_buf, FX_DWORD& dest_size)
{
if (m_Cipher == FXCIPHER_NONE) {
FXSYS_memcpy32(dest_buf, src_buf, src_size);
@@ -724,7 +724,7 @@ typedef struct _AESCryptContext {
uint8_t m_Block[16];
FX_DWORD m_BlockOffset;
} AESCryptContext;
-FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt)
+void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt)
{
if (m_Cipher == FXCIPHER_NONE) {
return this;
@@ -772,7 +772,7 @@ FX_LPVOID CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum, FX_DWORD gennu
CRYPT_ArcFourSetup(pContext, realkey, realkeylen);
return pContext;
}
-FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt)
+FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt)
{
if (!context) {
return FALSE;
@@ -825,7 +825,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(FX_LPVOID context, FX_LPCBYTE sr
}
return TRUE;
}
-FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt)
+FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context, CFX_BinaryBuf& dest_buf, FX_BOOL bEncrypt)
{
if (!context) {
return FALSE;
@@ -858,7 +858,7 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(FX_LPVOID context, CFX_BinaryBuf
FX_Free(pContext);
return TRUE;
}
-FX_LPVOID CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, FX_DWORD gennum)
+void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum, FX_DWORD gennum)
{
return CryptStart(objnum, gennum, FALSE);
}
@@ -868,7 +868,7 @@ FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size)
}
FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_SecurityHandler* pSecurityHandler)
{
- FX_LPCBYTE key;
+ const uint8_t* key;
if (!pSecurityHandler->GetCryptInfo(m_Cipher, key, m_KeyLen)) {
return FALSE;
}
@@ -883,7 +883,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(CPDF_Dictionary* pEncryptDict, CPDF_Sec
}
return TRUE;
}
-FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen)
+FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, const uint8_t* key, int keylen)
{
if (cipher == FXCIPHER_AES) {
switch(keylen) {
@@ -915,24 +915,24 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher, FX_LPCBYTE key, int keylen)
}
return TRUE;
}
-FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(FX_LPVOID context, FX_LPCBYTE src_buf, FX_DWORD src_size,
+FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(void* context, const uint8_t* src_buf, FX_DWORD src_size,
CFX_BinaryBuf& dest_buf)
{
return CryptStream(context, src_buf, src_size, dest_buf, FALSE);
}
-FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(FX_LPVOID context, CFX_BinaryBuf& dest_buf)
+FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(void* context, CFX_BinaryBuf& dest_buf)
{
return CryptFinish(context, dest_buf, FALSE);
}
-FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD version, FX_LPCBYTE src_buf, FX_DWORD src_size)
+FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum, FX_DWORD version, const uint8_t* src_buf, FX_DWORD src_size)
{
if (m_Cipher == FXCIPHER_AES) {
return src_size + 32;
}
return src_size;
}
-FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, FX_LPCBYTE src_buf, FX_DWORD src_size,
- FX_LPBYTE dest_buf, FX_DWORD& dest_size)
+FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gennum, const uint8_t* src_buf, FX_DWORD src_size,
+ uint8_t* dest_buf, FX_DWORD& dest_size)
{
CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size);
return TRUE;
@@ -940,8 +940,8 @@ FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum, FX_DWORD gen
void CPDF_CryptoHandler::Decrypt(FX_DWORD objnum, FX_DWORD gennum, CFX_ByteString& str)
{
CFX_BinaryBuf dest_buf;
- FX_LPVOID context = DecryptStart(objnum, gennum);
- DecryptStream(context, (FX_LPCBYTE)str, str.GetLength(), dest_buf);
+ void* context = DecryptStart(objnum, gennum);
+ DecryptStream(context, (const uint8_t*)str, str.GetLength(), dest_buf);
DecryptFinish(context, dest_buf);
str = dest_buf;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index 5bacfd7393..ceed675461 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -39,9 +39,9 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile)
}
return pDoc;
}
-CFDF_Document* CFDF_Document::ParseMemory(FX_LPCBYTE pData, FX_DWORD size)
+CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size)
{
- return CFDF_Document::ParseFile(FX_CreateMemoryStream((FX_LPBYTE)pData, size), TRUE);
+ return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size), TRUE);
}
void CFDF_Document::ParseStream(IFX_FileRead *pFile, FX_BOOL bOwnFile)
{
@@ -95,7 +95,7 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const
while(pos) {
size_t objnum;
CPDF_Object* pObj;
- m_IndirectObjs.GetNextAssoc(pos, (FX_LPVOID&)objnum, (FX_LPVOID&)pObj);
+ m_IndirectObjs.GetNextAssoc(pos, (void*&)objnum, (void*&)pObj);
buf << (FX_DWORD)objnum << FX_BSTRC(" 0 obj\r\n") << pObj << FX_BSTRC("\r\nendobj\r\n\r\n");
}
buf << FX_BSTRC("trailer\r\n<</Root ") << m_pRootDict->GetObjNum() << FX_BSTRC(" 0 R>>\r\n%%EOF\r\n");
@@ -113,7 +113,7 @@ CFX_WideString CFDF_Document::GetWin32Path() const
}
return FPDF_FileSpec_GetWin32Path(pFileSpec);
}
-static CFX_WideString ChangeSlash(FX_LPCWSTR str)
+static CFX_WideString ChangeSlash(const FX_WCHAR* str)
{
CFX_WideString result;
while (*str) {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
index 8cb0cee82a..97e68b5c0c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp
@@ -29,7 +29,7 @@ void CFX_DataFilter::SetDestFilter(CFX_DataFilter* pFilter)
m_pDestFilter = pFilter;
}
}
-void CFX_DataFilter::FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CFX_DataFilter::FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
if (m_bEOF) {
return;
@@ -199,7 +199,7 @@ CPDF_StreamFilter::~CPDF_StreamFilter()
}
}
#define FPDF_FILTER_BUFFER_IN_SIZE FPDF_FILTER_BUFFER_SIZE
-FX_DWORD CPDF_StreamFilter::ReadBlock(FX_LPBYTE buffer, FX_DWORD buf_size)
+FX_DWORD CPDF_StreamFilter::ReadBlock(uint8_t* buffer, FX_DWORD buf_size)
{
if (m_pFilter == NULL) {
FX_DWORD read_size = m_pStream->GetRawSize() - m_SrcOffset;
@@ -249,7 +249,7 @@ FX_DWORD CPDF_StreamFilter::ReadBlock(FX_LPBYTE buffer, FX_DWORD buf_size)
}
return read_size + ReadLeftOver(buffer, buf_size);
}
-FX_DWORD CPDF_StreamFilter::ReadLeftOver(FX_LPBYTE buffer, FX_DWORD buf_size)
+FX_DWORD CPDF_StreamFilter::ReadLeftOver(uint8_t* buffer, FX_DWORD buf_size)
{
FX_DWORD read_size = m_pBuffer->GetSize() - m_BufOffset;
if (read_size > buf_size) {
@@ -277,7 +277,7 @@ CPDF_DecryptFilter::~CPDF_DecryptFilter()
m_pCryptoHandler->DecryptFinish(m_pContext, buf);
}
}
-void CPDF_DecryptFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_DecryptFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
if (m_pContext == NULL) {
m_pContext = m_pCryptoHandler->DecryptStart(m_ObjNum, m_GenNum);
@@ -320,7 +320,7 @@ CPDF_FlateFilter::~CPDF_FlateFilter()
FPDFAPI_FlateEnd(m_pContext);
}
}
-void CPDF_FlateFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_FlateFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
if (m_pContext == NULL) {
m_pContext = FPDFAPI_FlateInit(my_alloc_func, my_free_func);
@@ -348,7 +348,7 @@ CPDF_LzwFilter::CPDF_LzwFilter(FX_BOOL bEarlyChange)
m_LeftBits = 0;
m_OldCode = (FX_DWORD) - 1;
}
-void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_LzwFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
for (FX_DWORD i = 0; i < src_size; i ++) {
if (m_nLeftBits + 8 < m_CodeLen) {
@@ -389,7 +389,7 @@ void CPDF_LzwFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_Binar
DecodeString(code);
}
dest_buf.AppendBlock(NULL, m_StackLen);
- FX_LPBYTE pOutput = dest_buf.GetBuffer() + dest_buf.GetSize() - m_StackLen;
+ uint8_t* pOutput = dest_buf.GetBuffer() + dest_buf.GetSize() - m_StackLen;
for (FX_DWORD cc = 0; cc < m_StackLen; cc ++) {
pOutput[cc] = m_DecodeStack[m_StackLen - cc - 1];
}
@@ -475,7 +475,7 @@ static uint8_t PaethPredictor(int a, int b, int c)
}
return (uint8_t)c;
}
-static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, int Bpp)
+static void PNG_PredictorLine(uint8_t* cur_buf, uint8_t* ref_buf, int pitch, int Bpp)
{
uint8_t tag = cur_buf[0];
if (tag == 0) {
@@ -535,7 +535,7 @@ static void PNG_PredictorLine(FX_LPBYTE cur_buf, FX_LPBYTE ref_buf, int pitch, i
}
}
}
-void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_PredictorFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
if (m_pCurLine == NULL) {
m_pCurLine = FX_Alloc(uint8_t, m_Pitch);
@@ -564,7 +564,7 @@ void CPDF_PredictorFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX
PNG_PredictorLine(m_pCurLine, m_iLine ? m_pRefLine : NULL, m_Pitch - 1, m_Bpp);
dest_buf.AppendBlock(m_pCurLine + 1, m_Pitch - 1);
m_iLine ++;
- FX_LPBYTE temp = m_pCurLine;
+ uint8_t* temp = m_pCurLine;
m_pCurLine = m_pRefLine;
m_pRefLine = temp;
}
@@ -576,7 +576,7 @@ CPDF_Ascii85Filter::CPDF_Ascii85Filter()
m_State = 0;
m_CharCount = 0;
}
-void CPDF_Ascii85Filter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_Ascii85Filter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
for (FX_DWORD i = 0; i < src_size; i ++) {
uint8_t byte = src_buf[i];
@@ -635,7 +635,7 @@ CPDF_AsciiHexFilter::CPDF_AsciiHexFilter()
{
m_State = 0;
}
-void CPDF_AsciiHexFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_AsciiHexFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
for (FX_DWORD i = 0; i < src_size; i ++) {
uint8_t byte = src_buf[i];
@@ -670,7 +670,7 @@ CPDF_RunLenFilter::CPDF_RunLenFilter()
m_State = 0;
m_Count = 0;
}
-void CPDF_RunLenFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_RunLenFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
for (FX_DWORD i = 0; i < src_size; i ++) {
uint8_t byte = src_buf[i];
@@ -719,12 +719,12 @@ CPDF_JpegFilter::~CPDF_JpegFilter()
CPDF_ModuleMgr::Get()->GetJpegModule()->Finish(m_pContext);
}
}
-void CPDF_JpegFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_JpegFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
if (m_pContext == NULL) {
m_pContext = CPDF_ModuleMgr::Get()->GetJpegModule()->Start();
}
- FX_LPCBYTE jpeg_src_buf;
+ const uint8_t* jpeg_src_buf;
FX_DWORD jpeg_src_size;
CFX_BinaryBuf temp_buf;
if (m_InputBuf.GetSize()) {
@@ -811,9 +811,9 @@ FX_BOOL CPDF_FaxFilter::Initialize(int Encoding, int bEndOfLine, int bByteAlign,
m_InputBitPos = 0;
return TRUE;
}
-void CPDF_FaxFilter::v_FilterIn(FX_LPCBYTE src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
+void CPDF_FaxFilter::v_FilterIn(const uint8_t* src_buf, FX_DWORD src_size, CFX_BinaryBuf& dest_buf)
{
- FX_LPCBYTE fax_src_buf;
+ const uint8_t* fax_src_buf;
FX_DWORD fax_src_size;
CFX_BinaryBuf temp_buf;
int bitpos;
@@ -840,9 +840,9 @@ void CPDF_FaxFilter::v_FilterFinish(CFX_BinaryBuf& dest_buf)
ProcessData(m_InputBuf.GetBuffer(), m_InputBuf.GetSize(), m_InputBitPos, TRUE, dest_buf);
}
FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos);
-FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, const uint8_t* ref_buf, int columns);
-FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, FX_LPBYTE dest_buf, int columns);
-void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
+FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns);
+FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns);
+void CPDF_FaxFilter::ProcessData(const uint8_t* src_buf, FX_DWORD src_size, int& bitpos, FX_BOOL bFinish,
CFX_BinaryBuf& dest_buf)
{
int bitsize = src_size * 8;
@@ -872,7 +872,7 @@ void CPDF_FaxFilter::ProcessData(FX_LPCBYTE src_buf, FX_DWORD src_size, int& bit
}
}
}
-FX_BOOL CPDF_FaxFilter::ReadLine(FX_LPCBYTE src_buf, int bitsize, int& bitpos)
+FX_BOOL CPDF_FaxFilter::ReadLine(const uint8_t* src_buf, int bitsize, int& bitpos)
{
if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) {
return FALSE;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index d636f96b68..5cc06e7929 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -51,7 +51,7 @@ CFX_ByteString CPDF_Object::GetString() const
case PDFOBJ_NAME:
return ((CPDF_Name*)this)->m_Name;
case PDFOBJ_REFERENCE: {
- CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
+ CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
if (pRef->m_pObjList == NULL) {
break;
}
@@ -68,11 +68,11 @@ CFX_ByteStringC CPDF_Object::GetConstString() const
{
switch (m_Type) {
case PDFOBJ_STRING:
- return CFX_ByteStringC((FX_LPCBYTE)((CPDF_String*)this)->m_String, ((CPDF_String*)this)->m_String.GetLength());
+ return CFX_ByteStringC((const uint8_t*)((CPDF_String*)this)->m_String, ((CPDF_String*)this)->m_String.GetLength());
case PDFOBJ_NAME:
- return CFX_ByteStringC((FX_LPCBYTE)((CPDF_Name*)this)->m_Name, ((CPDF_Name*)this)->m_Name.GetLength());
+ return CFX_ByteStringC((const uint8_t*)((CPDF_Name*)this)->m_Name, ((CPDF_Name*)this)->m_Name.GetLength());
case PDFOBJ_REFERENCE: {
- CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
+ CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
if (pRef->m_pObjList == NULL) {
break;
}
@@ -91,7 +91,7 @@ FX_FLOAT CPDF_Object::GetNumber() const
case PDFOBJ_NUMBER:
return ((CPDF_Number*)this)->GetNumber();
case PDFOBJ_REFERENCE: {
- CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
+ CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
if (pRef->m_pObjList == NULL) {
break;
}
@@ -120,7 +120,7 @@ int CPDF_Object::GetInteger() const
case PDFOBJ_NUMBER:
return ((CPDF_Number*)this)->GetInteger();
case PDFOBJ_REFERENCE: {
- CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
+ CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
PARSE_CONTEXT context;
FXSYS_memset32(&context, 0, sizeof(PARSE_CONTEXT));
if (pRef->m_pObjList == NULL) {
@@ -233,7 +233,7 @@ CPDF_Object* CPDF_Object::GetDirect() const
if (m_Type != PDFOBJ_REFERENCE) {
return (CPDF_Object*)this;
}
- CPDF_Reference* pRef = (CPDF_Reference*)(FX_LPVOID)this;
+ CPDF_Reference* pRef = (CPDF_Reference*)(void*)this;
if (pRef->m_pObjList == NULL) {
return NULL;
}
@@ -331,13 +331,13 @@ CFX_WideString CPDF_Object::GetUnicodeText(CFX_CharMap* pCharMap) const
}
return CFX_WideString();
}
-void CPDF_Object::SetUnicodeText(FX_LPCWSTR pUnicodes, int len)
+void CPDF_Object::SetUnicodeText(const FX_WCHAR* pUnicodes, int len)
{
if (m_Type == PDFOBJ_STRING) {
((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len);
} else if (m_Type == PDFOBJ_STREAM) {
CFX_ByteString result = PDF_EncodeText(pUnicodes, len);
- ((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLength(), FALSE, FALSE);
+ ((CPDF_Stream*)this)->SetData((uint8_t*)result.c_str(), result.GetLength(), FALSE, FALSE);
}
}
@@ -570,7 +570,7 @@ CPDF_Dictionary::~CPDF_Dictionary()
{
FX_POSITION pos = m_Map.GetStartPosition();
while (pos) {
- FX_LPVOID value = m_Map.GetNextValue(pos);
+ void* value = m_Map.GetNextValue(pos);
if (value)
((CPDF_Object*)value)->Release();
}
@@ -585,7 +585,7 @@ CPDF_Object* CPDF_Dictionary::GetNextElement(FX_POSITION& pos, CFX_ByteString& k
return NULL;
}
CPDF_Object* p;
- m_Map.GetNextAssoc(pos, key, (FX_LPVOID&)p);
+ m_Map.GetNextAssoc(pos, key, (void*&)p);
return p;
}
CPDF_Object* CPDF_Dictionary::GetElement(FX_BSTR key) const
@@ -736,7 +736,7 @@ CFX_AffineMatrix CPDF_Dictionary::GetMatrix(FX_BSTR key) const
}
FX_BOOL CPDF_Dictionary::KeyExist(FX_BSTR key) const
{
- FX_LPVOID value;
+ void* value;
return m_Map.Lookup(key, value);
}
void CPDF_Dictionary::SetAt(FX_BSTR key, CPDF_Object* pObj, CPDF_IndirectObjects* pObjs)
@@ -797,7 +797,7 @@ FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const
FX_POSITION pos = m_Map.GetStartPosition();
while (pos) {
CFX_ByteString key;
- FX_LPVOID value;
+ void* value;
m_Map.GetNextAssoc(pos, key, value);
if (!value)
return FALSE;
@@ -857,7 +857,7 @@ void CPDF_Dictionary::SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix)
pArray->AddNumber(matrix.f);
SetAt(key, pArray);
}
-CPDF_Stream::CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict)
+CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict)
: CPDF_Object(PDFOBJ_STREAM) {
m_pDict = pDict;
m_dwSize = size;
@@ -892,7 +892,7 @@ void CPDF_Stream::InitStream(CPDF_Dictionary* pDict)
m_pCryptoHandler = NULL;
m_FileOffset = 0;
}
-void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict)
+void CPDF_Stream::InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict)
{
InitStream(pDict);
m_GenNum = (FX_DWORD) - 1;
@@ -905,7 +905,7 @@ void CPDF_Stream::InitStream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pD
m_pDict->SetAtInteger(FX_BSTRC("Length"), size);
}
}
-void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf)
+void CPDF_Stream::SetData(const uint8_t* pData, FX_DWORD size, FX_BOOL bCompressed, FX_BOOL bKeepBuf)
{
if (m_GenNum == (FX_DWORD) - 1) {
if (m_pDataBuf) {
@@ -916,7 +916,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed,
m_pCryptoHandler = NULL;
}
if (bKeepBuf) {
- m_pDataBuf = (FX_LPBYTE)pData;
+ m_pDataBuf = (uint8_t*)pData;
} else {
m_pDataBuf = FX_Alloc(uint8_t, size);
if (pData) {
@@ -933,7 +933,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed,
m_pDict->RemoveAt(FX_BSTRC("DecodeParms"));
}
}
-FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, FX_LPBYTE buf, FX_DWORD size) const
+FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset, uint8_t* buf, FX_DWORD size) const
{
if ((m_GenNum != (FX_DWORD) - 1) && m_pFile) {
return m_pFile->ReadBlock(buf, m_FileOffset + offset, size);
@@ -993,7 +993,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
}
if (m_GenNum != (FX_DWORD) - 1 || pOther->m_GenNum != (FX_DWORD) - 1) {
IFX_FileRead* pFile = NULL;
- FX_LPBYTE pBuf = NULL;
+ uint8_t* pBuf = NULL;
FX_DWORD offset = 0;
if (m_GenNum != (FX_DWORD) - 1) {
pFile = m_pFile;
@@ -1024,7 +1024,7 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const
}
return FXSYS_memcmp32(m_pDataBuf, pOther->m_pDataBuf, m_dwSize) == 0;
}
-CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, FX_LPVOID pUserData) const
+CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpfCallback, void* pUserData) const
{
CPDF_Dictionary *pCloneDict = (CPDF_Dictionary*)m_pDict->Clone(bDirect);
IFX_FileStream *pFS = NULL;
@@ -1040,7 +1040,7 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf
CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL);
CPDF_StreamFilter *pSF = GetStreamFilter(TRUE);
if (pSF) {
- FX_LPBYTE pBuf = FX_Alloc(uint8_t, 4096);
+ uint8_t* pBuf = FX_Alloc(uint8_t, 4096);
FX_DWORD dwRead;
do {
dwRead = pSF->ReadBlock(pBuf, 4096);
@@ -1055,8 +1055,8 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf
pObj->InitStream((IFX_FileRead*)pFS, pCloneDict);
return pObj;
}
-extern FX_BOOL PDF_DataDecode(FX_LPCBYTE src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
- FX_LPBYTE& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding,
+extern FX_BOOL PDF_DataDecode(const uint8_t* src_buf, FX_DWORD src_size, const CPDF_Dictionary* pDict,
+ uint8_t*& dest_buf, FX_DWORD& dest_size, CFX_ByteString& ImageEncoding,
CPDF_Dictionary*& pImageParms, FX_DWORD estimated_size, FX_BOOL bImageAcc);
CPDF_StreamAcc::CPDF_StreamAcc()
{
@@ -1077,10 +1077,10 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess,
if (pStream->IsMemoryBased() &&
(!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess)) {
m_dwSize = pStream->m_dwSize;
- m_pData = (FX_LPBYTE)pStream->m_pDataBuf;
+ m_pData = (uint8_t*)pStream->m_pDataBuf;
return;
}
- FX_LPBYTE pSrcData;
+ uint8_t* pSrcData;
FX_DWORD dwSrcSize = pStream->m_dwSize;
if (dwSrcSize == 0) {
return;
@@ -1093,12 +1093,12 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, FX_BOOL bRawAccess,
} else {
pSrcData = pStream->m_pDataBuf;
}
- FX_LPBYTE pDecryptedData;
+ uint8_t* pDecryptedData;
FX_DWORD dwDecryptedSize;
if (pStream->m_pCryptoHandler) {
CFX_BinaryBuf dest_buf;
dest_buf.EstimateSize(pStream->m_pCryptoHandler->DecryptGetSize(dwSrcSize));
- FX_LPVOID context = pStream->m_pCryptoHandler->DecryptStart(pStream->GetObjNum(), pStream->m_GenNum);
+ void* context = pStream->m_pCryptoHandler->DecryptStart(pStream->GetObjNum(), pStream->m_GenNum);
pStream->m_pCryptoHandler->DecryptStream(context, pSrcData, dwSrcSize, dest_buf);
pStream->m_pCryptoHandler->DecryptFinish(context, dest_buf);
pDecryptedData = dest_buf.GetBuffer();
@@ -1137,7 +1137,7 @@ CPDF_StreamAcc::~CPDF_StreamAcc()
FX_Free(m_pSrcData);
}
}
-FX_LPCBYTE CPDF_StreamAcc::GetData() const
+const uint8_t* CPDF_StreamAcc::GetData() const
{
if (m_bNewBuf) {
return m_pData;
@@ -1157,15 +1157,15 @@ FX_DWORD CPDF_StreamAcc::GetSize() const
}
return m_pStream->m_dwSize;
}
-FX_LPBYTE CPDF_StreamAcc::DetachData()
+uint8_t* CPDF_StreamAcc::DetachData()
{
if (m_bNewBuf) {
- FX_LPBYTE p = m_pData;
+ uint8_t* p = m_pData;
m_pData = NULL;
m_dwSize = 0;
return p;
}
- FX_LPBYTE p = FX_Alloc(uint8_t, m_dwSize);
+ uint8_t* p = FX_Alloc(uint8_t, m_dwSize);
FXSYS_memcpy32(p, m_pData, m_dwSize);
return p;
}
@@ -1188,7 +1188,8 @@ CPDF_IndirectObjects::~CPDF_IndirectObjects()
{
FX_POSITION pos = m_IndirectObjs.GetStartPosition();
while (pos) {
- FX_LPVOID key, value;
+ void* key;
+ void* value;
m_IndirectObjs.GetNextAssoc(pos, key, value);
((CPDF_Object*)value)->Destroy();
}
@@ -1198,9 +1199,9 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR
if (objnum == 0) {
return NULL;
}
- FX_LPVOID value;
+ void* value;
{
- if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
+ if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
if (((CPDF_Object*)value)->GetObjNum() == -1) {
return NULL;
}
@@ -1218,18 +1219,18 @@ CPDF_Object* CPDF_IndirectObjects::GetIndirectObject(FX_DWORD objnum, struct PAR
if (m_LastObjNum < objnum) {
m_LastObjNum = objnum;
}
- if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
+ if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
if (value) {
((CPDF_Object *)value)->Destroy();
}
}
- m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj);
+ m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj);
return pObj;
}
int CPDF_IndirectObjects::GetIndirectType(FX_DWORD objnum)
{
- FX_LPVOID value;
- if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
+ void* value;
+ if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
return ((CPDF_Object*)value)->GetType();
}
if (m_pParser) {
@@ -1246,29 +1247,29 @@ FX_DWORD CPDF_IndirectObjects::AddIndirectObject(CPDF_Object* pObj)
return pObj->m_ObjNum;
}
m_LastObjNum ++;
- m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)m_LastObjNum, pObj);
+ m_IndirectObjs.SetAt((void*)(uintptr_t)m_LastObjNum, pObj);
pObj->m_ObjNum = m_LastObjNum;
return m_LastObjNum;
}
void CPDF_IndirectObjects::ReleaseIndirectObject(FX_DWORD objnum)
{
- FX_LPVOID value;
- if (!m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
+ void* value;
+ if (!m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
return;
}
if (((CPDF_Object*)value)->GetObjNum() == -1) {
return;
}
((CPDF_Object*)value)->Destroy();
- m_IndirectObjs.RemoveKey((FX_LPVOID)(uintptr_t)objnum);
+ m_IndirectObjs.RemoveKey((void*)(uintptr_t)objnum);
}
void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj)
{
if (objnum == 0 || pObj == NULL) {
return;
}
- FX_LPVOID value = NULL;
- if (m_IndirectObjs.Lookup((FX_LPVOID)(uintptr_t)objnum, value)) {
+ void* value = NULL;
+ if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, value)) {
if (value)
{
if (pObj->GetGenNum() <= ((CPDF_Object*)value)->GetGenNum())
@@ -1278,7 +1279,7 @@ void CPDF_IndirectObjects::InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pO
}
}
pObj->m_ObjNum = objnum;
- m_IndirectObjs.SetAt((FX_LPVOID)(uintptr_t)objnum, pObj);
+ m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj);
if (m_LastObjNum < objnum) {
m_LastObjNum = objnum;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 4afc3a668b..09c5c39e4f 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -88,7 +88,7 @@ void CPDF_Parser::CloseParser(FX_BOOL bReParse)
}
FX_POSITION pos = m_ObjectStreamMap.GetStartPosition();
while (pos) {
- FX_LPVOID objnum;
+ void* objnum;
CPDF_StreamAcc* pStream;
m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream);
delete pStream;
@@ -128,7 +128,7 @@ static int32_t GetHeaderOffset(IFX_FileRead* pFile)
}
return -1;
}
-FX_DWORD CPDF_Parser::StartParse(FX_LPCSTR filename, FX_BOOL bReParse)
+FX_DWORD CPDF_Parser::StartParse(const FX_CHAR* filename, FX_BOOL bReParse)
{
IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
if (!pFileAccess) {
@@ -136,7 +136,7 @@ FX_DWORD CPDF_Parser::StartParse(FX_LPCSTR filename, FX_BOOL bReParse)
}
return StartParse(pFileAccess, bReParse);
}
-FX_DWORD CPDF_Parser::StartParse(FX_LPCWSTR filename, FX_BOOL bReParse)
+FX_DWORD CPDF_Parser::StartParse(const FX_WCHAR* filename, FX_BOOL bReParse)
{
IFX_FileRead* pFileAccess = FX_CreateFileRead(filename);
if (!pFileAccess) {
@@ -183,7 +183,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX
FX_BOOL bXRefRebuilt = FALSE;
if (m_Syntax.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, 4096)) {
FX_FILESIZE startxref_offset = m_Syntax.SavePos();
- FX_LPVOID pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(startxref_offset);
}
@@ -444,7 +444,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
{
FX_FILESIZE dwStartPos = pos - m_Syntax.m_HeaderOffset;
m_Syntax.RestorePos(dwStartPos);
- FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(pos);
}
@@ -462,7 +462,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
FX_Free(pBuf);
return FALSE;
}
- if (!m_Syntax.ReadBlock((FX_LPBYTE)pBuf, dwReadSize)) {
+ if (!m_Syntax.ReadBlock((uint8_t*)pBuf, dwReadSize)) {
FX_Free(pBuf);
return FALSE;
}
@@ -489,7 +489,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCou
}
m_ObjVersion.SetAtGrow(objnum, version);
if (m_CrossRef[objnum] < m_Syntax.m_FileLen) {
- FX_LPVOID pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(m_CrossRef[objnum]);
}
@@ -508,12 +508,12 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
if (m_Syntax.GetKeyword() != FX_BSTRC("xref")) {
return FALSE;
}
- FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(pos);
}
if (streampos) {
- FX_LPVOID pResult = FXSYS_bsearch(&streampos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&streampos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(streampos);
}
@@ -549,7 +549,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
FX_BOOL bFirstBlock = TRUE;
for (int32_t block = 0; block < nBlocks; block ++) {
int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
- m_Syntax.ReadBlock((FX_LPBYTE)pBuf, block_size * recordsize);
+ m_Syntax.ReadBlock((uint8_t*)pBuf, block_size * recordsize);
for (int32_t i = 0; i < block_size; i ++) {
FX_DWORD objnum = start_objnum + block * 1024 + i;
char* pEntry = pBuf + i * recordsize;
@@ -585,7 +585,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_B
}
m_ObjVersion.SetAtGrow(objnum, version);
if (m_CrossRef[objnum] < m_Syntax.m_FileLen) {
- FX_LPVOID pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&m_CrossRef[objnum], m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(m_CrossRef[objnum]);
}
@@ -634,7 +634,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
int32_t inside_index = 0;
FX_DWORD objnum = 0, gennum = 0;
int32_t depth = 0;
- FX_LPBYTE buffer = FX_Alloc(uint8_t, 4096);
+ uint8_t* buffer = FX_Alloc(uint8_t, 4096);
FX_FILESIZE pos = m_Syntax.m_HeaderOffset;
FX_FILESIZE start_pos = 0, start_pos1 = 0;
FX_FILESIZE last_obj = -1, last_xref = -1, last_trailer = -1;
@@ -780,7 +780,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
}
FX_FILESIZE obj_pos = start_pos - m_Syntax.m_HeaderOffset;
last_obj = start_pos;
- FX_LPVOID pResult = FXSYS_bsearch(&obj_pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&obj_pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(obj_pos);
}
@@ -983,14 +983,14 @@ FX_BOOL CPDF_Parser::RebuildCrossRef()
last_trailer = m_Syntax.m_FileLen;
}
FX_FILESIZE offset = last_trailer - m_Syntax.m_HeaderOffset;
- FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(offset);
}
FX_Free(buffer);
return TRUE;
}
-static FX_DWORD _GetVarInt(FX_LPCBYTE p, int32_t n)
+static FX_DWORD _GetVarInt(const uint8_t* p, int32_t n)
{
FX_DWORD result = 0;
for (int32_t i = 0; i < n; i ++) {
@@ -1071,7 +1071,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
FX_DWORD totalWidth = dwAccWidth.ValueOrDie();
CPDF_StreamAcc acc;
acc.LoadAllData(pStream);
- FX_LPCBYTE pData = acc.GetData();
+ const uint8_t* pData = acc.GetData();
FX_DWORD dwTotalSize = acc.GetSize();
FX_DWORD segindex = 0;
for (FX_DWORD i = 0; i < arrIndex.size(); i ++) {
@@ -1087,7 +1087,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
if (!dwCaculatedSize.IsValid() || dwCaculatedSize.ValueOrDie() > dwTotalSize) {
continue;
}
- FX_LPCBYTE segstart = pData + segindex * totalWidth;
+ const uint8_t* segstart = pData + segindex * totalWidth;
FX_SAFE_DWORD dwMaxObjNum = startnum;
dwMaxObjNum += count;
FX_DWORD dwV5Size = pdfium::base::checked_cast<FX_DWORD, int32_t> (m_V5Type.GetSize());
@@ -1096,14 +1096,14 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
}
for (FX_DWORD j = 0; j < count; j ++) {
int32_t type = 1;
- FX_LPCBYTE entrystart = segstart + j * totalWidth;
+ const uint8_t* entrystart = segstart + j * totalWidth;
if (WidthArray[0]) {
type = _GetVarInt(entrystart, WidthArray[0]);
}
if (m_V5Type[startnum + j] == 255) {
FX_FILESIZE offset = _GetVarInt(entrystart + WidthArray[0], WidthArray[1]);
m_CrossRef[startnum + j] = offset;
- FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(offset);
}
@@ -1119,7 +1119,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
FX_FILESIZE offset = _GetVarInt(entrystart + WidthArray[0], WidthArray[1]);
m_CrossRef[startnum + j] = offset;
if (type == 1) {
- FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_SortedOffset.Add(offset);
}
@@ -1181,7 +1181,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm)
return TRUE;
}
FX_FILESIZE pos = m_CrossRef[objnum];
- FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
return TRUE;
}
@@ -1215,7 +1215,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(CPDF_IndirectObjects* pObjList, FX
int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
CPDF_SyntaxParser syntax;
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pObjStream->GetData(), (size_t)pObjStream->GetSize(), FALSE));
syntax.InitParser(file.Get(), 0);
CPDF_Object* pRet = NULL;
while (n) {
@@ -1260,7 +1260,7 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum)
if (offset == 0) {
return 0;
}
- FX_LPVOID pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&offset, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
return 0;
}
@@ -1271,7 +1271,7 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum)
}
return 0;
}
-void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWORD& size)
+void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size)
{
pBuffer = NULL;
size = 0;
@@ -1286,9 +1286,9 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR
int32_t n = pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
int32_t offset = pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
CPDF_SyntaxParser syntax;
- FX_LPCBYTE pData = pObjStream->GetData();
+ const uint8_t* pData = pObjStream->GetData();
FX_DWORD totalsize = pObjStream->GetSize();
- CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((FX_LPBYTE)pData, (size_t)totalsize, FALSE));
+ CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE));
syntax.InitParser(file.Get(), 0);
while (n) {
FX_DWORD thisnum = syntax.GetDirectNum();
@@ -1336,7 +1336,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum, FX_LPBYTE& pBuffer, FX_DWOR
m_Syntax.RestorePos(SavedPos);
return;
}
- FX_LPVOID pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&pos, m_SortedOffset.GetData(), m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
m_Syntax.RestorePos(SavedPos);
return;
@@ -1666,7 +1666,7 @@ FX_DWORD CPDF_Parser::LoadLinearizedMainXRefTable()
m_LastXRefOffset += dwCount;
FX_POSITION pos = m_ObjectStreamMap.GetStartPosition();
while (pos) {
- FX_LPVOID objnum;
+ void* objnum;
CPDF_StreamAcc* pStream;
m_ObjectStreamMap.GetNextAssoc(pos, objnum, (void*&)pStream);
delete pStream;
@@ -1769,7 +1769,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch)
ch = m_pFileBuf[pos - m_BufOffset];
return TRUE;
}
-FX_BOOL CPDF_SyntaxParser::ReadBlock(FX_LPBYTE pBuf, FX_DWORD size)
+FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size)
{
if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size)) {
return FALSE;
@@ -2051,12 +2051,12 @@ CFX_ByteString CPDF_SyntaxParser::GetNextWord(FX_BOOL& bIsNumber)
{
GetNextWord();
bIsNumber = m_bIsNumber;
- return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize);
+ return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize);
}
CFX_ByteString CPDF_SyntaxParser::GetKeyword()
{
GetNextWord();
- return CFX_ByteString((FX_LPCSTR)m_WordBuffer, m_WordSize);
+ return CFX_ByteString((const FX_CHAR*)m_WordBuffer, m_WordSize);
}
CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWORD objnum, FX_DWORD gennum, PARSE_CONTEXT* pContext, FX_BOOL bDecrypt)
{
@@ -2481,12 +2481,12 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT
m_Pos = StreamStartPos;
}
CPDF_Stream* pStream;
- FX_LPBYTE pData = FX_Alloc(uint8_t, len);
+ uint8_t* pData = FX_Alloc(uint8_t, len);
ReadBlock(pData, len);
if (pCryptoHandler) {
CFX_BinaryBuf dest_buf;
dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len));
- FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum);
+ void* context = pCryptoHandler->DecryptStart(objnum, gennum);
pCryptoHandler->DecryptStream(context, pData, len, dest_buf);
pCryptoHandler->DecryptFinish(context, dest_buf);
FX_Free(pData);
@@ -2526,9 +2526,9 @@ int32_t CPDF_SyntaxParser::GetDirectNum()
return 0;
}
m_WordBuffer[m_WordSize] = 0;
- return FXSYS_atoi((FX_LPCSTR)m_WordBuffer);
+ return FXSYS_atoi((const FX_CHAR*)m_WordBuffer);
}
-FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, FX_LPCBYTE tag, FX_DWORD taglen)
+FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos, FX_FILESIZE limit, const uint8_t* tag, FX_DWORD taglen)
{
uint8_t type = PDF_CharType[tag[0]];
FX_BOOL bCheckLeft = type != 'D' && type != 'W';
@@ -2560,7 +2560,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL b
if (!bForward) {
offset = taglen - 1;
}
- FX_LPCBYTE tag_data = tag.GetPtr();
+ const uint8_t* tag_data = tag.GetPtr();
uint8_t byte;
while (1) {
if (bForward) {
@@ -2616,7 +2616,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(FX_BSTR tag, FX_BOOL bWholeWord, FX_BOOL b
return FALSE;
}
struct _SearchTagRecord {
- FX_LPCBYTE m_pTag;
+ const uint8_t* m_pTag;
FX_DWORD m_Len;
FX_DWORD m_Offset;
};
@@ -2771,7 +2771,7 @@ protected:
FX_BOOL CheckAllCrossRefStream(IFX_DownloadHints *pHints);
int32_t CheckCrossRefStream(IFX_DownloadHints *pHints, FX_FILESIZE &xref_offset);
- FX_BOOL IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen);
+ FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
FX_BOOL GetNextToken(CFX_ByteString &token);
FX_BOOL GetNextChar(uint8_t &ch);
@@ -3021,7 +3021,7 @@ FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset)
if (offset == 0) {
return 0;
}
- FX_LPVOID pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), pParser->m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
+ void* pResult = FXSYS_bsearch(&offset, pParser->m_SortedOffset.GetData(), pParser->m_SortedOffset.GetSize(), sizeof(FX_FILESIZE), _CompareFileSize);
if (pResult == NULL) {
return 0;
}
@@ -3710,7 +3710,7 @@ int32_t CPDF_DataAvail::IsLinearizedPDF()
}
return PDF_NOT_LINEARIZED;
}
-FX_BOOL CPDF_DataAvail::IsLinearizedFile(FX_LPBYTE pData, FX_DWORD dwLen)
+FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen)
{
CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE));
int32_t offset = GetHeaderOffset(file.Get());
@@ -3794,7 +3794,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints, FX_FILESI
if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) {
int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam);
CFX_BinaryBuf buf(iSize);
- FX_LPBYTE pBuf = buf.GetBuffer();
+ uint8_t* pBuf = buf.GetBuffer();
m_pFileRead->ReadBlock(pBuf, m_dwCurrentXRefSteam, iSize);
CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
m_parser.m_Syntax.InitParser(file.Get(), 0);
@@ -4032,7 +4032,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
if (m_pFileAvail->IsDataAvail(m_Pos, iTrailerSize)) {
int32_t iSize = (int32_t)(m_Pos + iTrailerSize - m_dwTrailerOffset);
CFX_BinaryBuf buf(iSize);
- FX_LPBYTE pBuf = buf.GetBuffer();
+ uint8_t* pBuf = buf.GetBuffer();
if (!pBuf) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index b02139db0f..e6474550a2 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -43,7 +43,7 @@ const char PDF_CharType[256] = {
#ifndef MAX_PATH
#define MAX_PATH 4096
#endif
-CPDF_SimpleParser::CPDF_SimpleParser(FX_LPCBYTE pData, FX_DWORD dwSize)
+CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize)
{
m_pData = pData;
m_dwSize = dwSize;
@@ -55,7 +55,7 @@ CPDF_SimpleParser::CPDF_SimpleParser(FX_BSTR str)
m_dwSize = str.GetLength();
m_dwCurPos = 0;
}
-void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& type)
+void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize, int& type)
{
pStart = NULL;
dwSize = 0;
@@ -153,7 +153,7 @@ void CPDF_SimpleParser::ParseWord(FX_LPCBYTE& pStart, FX_DWORD& dwSize, int& typ
}
CFX_ByteStringC CPDF_SimpleParser::GetWord()
{
- FX_LPCBYTE pStart;
+ const uint8_t* pStart;
FX_DWORD dwSize;
int type;
ParseWord(pStart, dwSize, type);
@@ -290,13 +290,13 @@ static int _hex2dec(char ch)
CFX_ByteString PDF_NameDecode(FX_BSTR bstr)
{
int size = bstr.GetLength();
- FX_LPCSTR pSrc = bstr.GetCStr();
+ const FX_CHAR* pSrc = bstr.GetCStr();
if (FXSYS_memchr(pSrc, '#', size) == NULL) {
return bstr;
}
CFX_ByteString result;
- FX_LPSTR pDestStart = result.GetBuffer(size);
- FX_LPSTR pDest = pDestStart;
+ FX_CHAR* pDestStart = result.GetBuffer(size);
+ FX_CHAR* pDest = pDestStart;
for (int i = 0; i < size; i ++) {
if (pSrc[i] == '#' && i < size - 2) {
*pDest ++ = _hex2dec(pSrc[i + 1]) * 16 + _hex2dec(pSrc[i + 2]);
@@ -317,7 +317,7 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig)
}
CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig)
{
- FX_LPBYTE src_buf = (FX_LPBYTE)orig.c_str();
+ uint8_t* src_buf = (uint8_t*)orig.c_str();
int src_len = orig.GetLength();
int dest_len = 0;
int i;
@@ -334,7 +334,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig)
return orig;
}
CFX_ByteString res;
- FX_LPSTR dest_buf = res.GetBuffer(dest_len);
+ FX_CHAR* dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i ++) {
uint8_t ch = src_buf[i];