summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-03-25 15:18:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 15:18:36 -0700
commitb5e8f14e3eefc5da995b332788d3203cee204883 (patch)
tree34fc80504d2034013b18f30df1b0f6f1a94e2d70 /core/fpdfapi/fpdf_parser
parent6d18bd3b8ec82ae3c24a439f5c7925786a0e2d8b (diff)
downloadpdfium-b5e8f14e3eefc5da995b332788d3203cee204883.tar.xz
Remove FX_DWORD from core/ and delete definitionchromium/2695chromium/2694chromium/2693chromium/2692
Review URL: https://codereview.chromium.org/1832173003
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r--core/fpdfapi/fpdf_parser/cfdf_document.cpp4
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_array.cpp44
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp106
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_data_avail.h42
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp4
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp30
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp68
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_hint_tables.h16
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp8
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_parser.cpp148
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_reference.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp10
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp48
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h32
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp64
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h36
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_stream.cpp12
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp8
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp44
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h22
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp94
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp4
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/include/cfdf_document.h2
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_array.h30
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h4
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_document.h16
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h18
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_object.h8
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_parser.h56
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_reference.h6
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h10
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_stream.h16
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h6
-rw-r--r--core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h48
-rw-r--r--core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h6
-rw-r--r--core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h22
-rw-r--r--core/fpdfapi/fpdf_parser/ipdf_security_handler.h2
38 files changed, 549 insertions, 549 deletions
diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
index dec8fbdfaf..9cbf999702 100644
--- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
@@ -40,7 +40,7 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
}
return pDoc;
}
-CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size) {
+CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, uint32_t size) {
return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size),
TRUE);
}
@@ -53,7 +53,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
bool bNumber;
CFX_ByteString word = parser.GetNextWord(&bNumber);
if (bNumber) {
- FX_DWORD objnum = FXSYS_atoui(word);
+ uint32_t objnum = FXSYS_atoui(word);
word = parser.GetNextWord(&bNumber);
if (!bNumber) {
break;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
index acd39a9390..69de5bbc26 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
@@ -76,43 +76,43 @@ CFX_Matrix CPDF_Array::GetMatrix() {
return matrix;
}
-CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CPDF_Object* CPDF_Array::GetElement(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return nullptr;
return m_Objects.GetAt(i);
}
-CPDF_Object* CPDF_Array::GetElementValue(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CPDF_Object* CPDF_Array::GetElementValue(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return nullptr;
return m_Objects.GetAt(i)->GetDirect();
}
-CFX_ByteString CPDF_Array::GetStringAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CFX_ByteString CPDF_Array::GetStringAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return CFX_ByteString();
return m_Objects.GetAt(i)->GetString();
}
-CFX_ByteStringC CPDF_Array::GetConstStringAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CFX_ByteStringC CPDF_Array::GetConstStringAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return CFX_ByteStringC();
return m_Objects.GetAt(i)->GetConstString();
}
-int CPDF_Array::GetIntegerAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+int CPDF_Array::GetIntegerAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return 0;
return m_Objects.GetAt(i)->GetInteger();
}
-FX_FLOAT CPDF_Array::GetNumberAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+FX_FLOAT CPDF_Array::GetNumberAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return 0;
return m_Objects.GetAt(i)->GetNumber();
}
-CPDF_Dictionary* CPDF_Array::GetDictAt(FX_DWORD i) const {
+CPDF_Dictionary* CPDF_Array::GetDictAt(uint32_t i) const {
CPDF_Object* p = GetElementValue(i);
if (!p)
return NULL;
@@ -123,16 +123,16 @@ CPDF_Dictionary* CPDF_Array::GetDictAt(FX_DWORD i) const {
return NULL;
}
-CPDF_Stream* CPDF_Array::GetStreamAt(FX_DWORD i) const {
+CPDF_Stream* CPDF_Array::GetStreamAt(uint32_t i) const {
return ToStream(GetElementValue(i));
}
-CPDF_Array* CPDF_Array::GetArrayAt(FX_DWORD i) const {
+CPDF_Array* CPDF_Array::GetArrayAt(uint32_t i) const {
return ToArray(GetElementValue(i));
}
-void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+void CPDF_Array::RemoveAt(uint32_t i, int nCount) {
+ if (i >= (uint32_t)m_Objects.GetSize())
return;
if (nCount <= 0 || nCount > m_Objects.GetSize() - i)
@@ -145,12 +145,12 @@ void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) {
m_Objects.RemoveAt(i, nCount);
}
-void CPDF_Array::SetAt(FX_DWORD i,
+void CPDF_Array::SetAt(uint32_t i,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs) {
ASSERT(IsArray());
- ASSERT(i < (FX_DWORD)m_Objects.GetSize());
- if (i >= (FX_DWORD)m_Objects.GetSize())
+ ASSERT(i < (uint32_t)m_Objects.GetSize());
+ if (i >= (uint32_t)m_Objects.GetSize())
return;
if (CPDF_Object* pOld = m_Objects.GetAt(i))
pOld->Release();
@@ -161,7 +161,7 @@ void CPDF_Array::SetAt(FX_DWORD i,
m_Objects.SetAt(i, pObj);
}
-void CPDF_Array::InsertAt(FX_DWORD index,
+void CPDF_Array::InsertAt(uint32_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs) {
if (pObj->GetObjNum()) {
@@ -201,7 +201,7 @@ void CPDF_Array::AddNumber(FX_FLOAT f) {
}
void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum) {
+ uint32_t objnum) {
ASSERT(IsArray());
Add(new CPDF_Reference(pDoc, objnum));
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
index 2c41c13a5a..858133d58e 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
@@ -46,7 +46,7 @@ CPDF_DataAvail::CPDF_DataAvail(IPDF_DataAvail::FileAvail* pFileAvail,
m_Pos = 0;
m_dwFileLen = 0;
if (m_pFileRead) {
- m_dwFileLen = (FX_DWORD)m_pFileRead->GetSize();
+ m_dwFileLen = (uint32_t)m_pFileRead->GetSize();
}
m_dwCurrentOffset = 0;
m_dwXRefOffset = 0;
@@ -107,7 +107,7 @@ void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
m_pDocument = pDoc;
}
-FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) {
+uint32_t CPDF_DataAvail::GetObjectSize(uint32_t objnum, FX_FILESIZE& offset) {
CPDF_Parser* pParser = m_pDocument->GetParser();
if (!pParser || !pParser->IsValidObjectNumber(objnum))
return 0;
@@ -140,7 +140,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
if (!obj_array.GetSize())
return TRUE;
- FX_DWORD count = 0;
+ uint32_t count = 0;
CFX_ArrayTemplate<CPDF_Object*> new_obj_array;
int32_t i = 0;
for (i = 0; i < obj_array.GetSize(); i++) {
@@ -152,7 +152,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
switch (type) {
case CPDF_Object::ARRAY: {
CPDF_Array* pArray = pObj->GetArray();
- for (FX_DWORD k = 0; k < pArray->GetCount(); ++k)
+ for (uint32_t k = 0; k < pArray->GetCount(); ++k)
new_obj_array.Add(pArray->GetElement(k));
} break;
case CPDF_Object::STREAM:
@@ -171,10 +171,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
} break;
case CPDF_Object::REFERENCE: {
CPDF_Reference* pRef = pObj->AsReference();
- FX_DWORD dwNum = pRef->GetRefObjNum();
+ uint32_t dwNum = pRef->GetRefObjNum();
FX_FILESIZE offset;
- FX_DWORD size = GetObjectSize(dwNum, offset);
+ uint32_t size = GetObjectSize(dwNum, offset);
if (size == 0 || offset < 0 || offset >= m_dwFileLen)
break;
@@ -197,7 +197,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
for (i = 0; i < iSize; ++i) {
CPDF_Object* pObj = new_obj_array[i];
if (CPDF_Reference* pRef = pObj->AsReference()) {
- FX_DWORD dwNum = pRef->GetRefObjNum();
+ uint32_t dwNum = pRef->GetRefObjNum();
if (!pdfium::ContainsKey(m_ObjectSet, dwNum))
ret_array.Add(pObj);
} else {
@@ -215,7 +215,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsDocAvail(
IPDF_DataAvail::DownloadHints* pHints) {
if (!m_dwFileLen && m_pFileRead) {
- m_dwFileLen = (FX_DWORD)m_pFileRead->GetSize();
+ m_dwFileLen = (uint32_t)m_pFileRead->GetSize();
if (!m_dwFileLen)
return DataError;
}
@@ -343,17 +343,17 @@ FX_BOOL CPDF_DataAvail::CheckPageStatus(IPDF_DataAvail::DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::LoadAllFile(IPDF_DataAvail::DownloadHints* pHints) {
- if (m_pFileAvail->IsDataAvail(0, (FX_DWORD)m_dwFileLen)) {
+ if (m_pFileAvail->IsDataAvail(0, (uint32_t)m_dwFileLen)) {
m_docStatus = PDF_DATAAVAIL_DONE;
return TRUE;
}
- pHints->AddSegment(0, (FX_DWORD)m_dwFileLen);
+ pHints->AddSegment(0, (uint32_t)m_dwFileLen);
return FALSE;
}
FX_BOOL CPDF_DataAvail::LoadAllXref(IPDF_DataAvail::DownloadHints* pHints) {
- m_parser.m_pSyntax->InitParser(m_pFileRead, (FX_DWORD)m_dwHeaderOffset);
+ m_parser.m_pSyntax->InitParser(m_pFileRead, (uint32_t)m_dwHeaderOffset);
m_parser.m_bOwnFileRead = false;
if (!m_parser.LoadAllCrossRefV4(m_dwLastXRefOffset) &&
!m_parser.LoadAllCrossRefV5(m_dwLastXRefOffset)) {
@@ -368,11 +368,11 @@ FX_BOOL CPDF_DataAvail::LoadAllXref(IPDF_DataAvail::DownloadHints* pHints) {
return TRUE;
}
-CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum,
+CPDF_Object* CPDF_DataAvail::GetObject(uint32_t objnum,
IPDF_DataAvail::DownloadHints* pHints,
FX_BOOL* pExistInFile) {
CPDF_Object* pRet = nullptr;
- FX_DWORD size = 0;
+ uint32_t size = 0;
FX_FILESIZE offset = 0;
CPDF_Parser* pParser = nullptr;
@@ -383,7 +383,7 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum,
size = GetObjectSize(objnum, offset);
pParser = m_pDocument->GetParser();
} else {
- size = (FX_DWORD)m_parser.GetObjectSize(objnum);
+ size = (uint32_t)m_parser.GetObjectSize(objnum);
offset = m_parser.GetObjectOffset(objnum);
pParser = &m_parser;
}
@@ -498,10 +498,10 @@ void CPDF_DataAvail::ResetFirstCheck(int iPage) {
}
FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) {
- FX_DWORD iPageObjs = m_PageObjList.GetSize();
- CFX_ArrayTemplate<FX_DWORD> UnavailObjList;
- for (FX_DWORD i = 0; i < iPageObjs; ++i) {
- FX_DWORD dwPageObjNum = m_PageObjList.GetAt(i);
+ uint32_t iPageObjs = m_PageObjList.GetSize();
+ CFX_ArrayTemplate<uint32_t> UnavailObjList;
+ for (uint32_t i = 0; i < iPageObjs; ++i) {
+ uint32_t dwPageObjNum = m_PageObjList.GetAt(i);
FX_BOOL bExist = FALSE;
CPDF_Object* pObj = GetObject(dwPageObjNum, pHints, &bExist);
if (!pObj) {
@@ -540,8 +540,8 @@ FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) {
return FALSE;
}
- FX_DWORD iPages = m_PagesArray.GetSize();
- for (FX_DWORD i = 0; i < iPages; i++) {
+ uint32_t iPages = m_PagesArray.GetSize();
+ for (uint32_t i = 0; i < iPages; i++) {
CPDF_Object* pPages = m_PagesArray.GetAt(i);
if (!pPages)
continue;
@@ -583,7 +583,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
- for (FX_DWORD i = 0; i < pKidsArray->GetCount(); ++i) {
+ for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) {
if (CPDF_Reference* pRef = ToReference(pKidsArray->GetElement(i)))
m_PageObjList.Add(pRef->GetRefObjNum());
}
@@ -623,9 +623,9 @@ FX_BOOL CPDF_DataAvail::CheckPages(IPDF_DataAvail::DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::CheckHeader(IPDF_DataAvail::DownloadHints* pHints) {
- FX_DWORD req_size = 1024;
+ uint32_t req_size = 1024;
if ((FX_FILESIZE)req_size > m_dwFileLen)
- req_size = (FX_DWORD)m_dwFileLen;
+ req_size = (uint32_t)m_dwFileLen;
if (m_pFileAvail->IsDataAvail(0, req_size)) {
uint8_t buffer[1024];
@@ -667,10 +667,10 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) {
FX_BOOL bNeedDownLoad = FALSE;
if (pEndOffSet->IsNumber()) {
- FX_DWORD dwEnd = pEndOffSet->GetInteger();
+ uint32_t dwEnd = pEndOffSet->GetInteger();
dwEnd += 512;
if ((FX_FILESIZE)dwEnd > m_dwFileLen)
- dwEnd = (FX_DWORD)m_dwFileLen;
+ dwEnd = (uint32_t)m_dwFileLen;
int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen);
int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0;
@@ -689,9 +689,9 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) {
dwFileLen = pFileLen->GetInteger();
if (!m_pFileAvail->IsDataAvail(m_dwLastXRefOffset,
- (FX_DWORD)(dwFileLen - m_dwLastXRefOffset))) {
+ (uint32_t)(dwFileLen - m_dwLastXRefOffset))) {
if (m_docStatus == PDF_DATAAVAIL_FIRSTPAGE) {
- FX_DWORD dwSize = (FX_DWORD)(dwFileLen - m_dwLastXRefOffset);
+ uint32_t dwSize = (uint32_t)(dwFileLen - m_dwLastXRefOffset);
FX_FILESIZE offset = m_dwLastXRefOffset;
if (dwSize < 512 && dwFileLen > 512) {
dwSize = 512;
@@ -714,12 +714,12 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset,
- FX_DWORD size,
+ uint32_t size,
IPDF_DataAvail::DownloadHints* pHints) {
if (offset > m_dwFileLen)
return TRUE;
- FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<FX_DWORD>(offset);
+ FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<uint32_t>(offset);
safeSize += size;
safeSize += 512;
if (!safeSize.IsValid() || safeSize.ValueOrDie() > m_dwFileLen)
@@ -785,7 +785,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IPDF_DataAvail::DownloadHints* pHints) {
CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
CPDF_IndirectObjectHolder* pObjList) {
FX_FILESIZE SavedPos = m_syntaxParser.SavePos();
m_syntaxParser.RestorePos(pos);
@@ -795,7 +795,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
if (!bIsNumber)
return nullptr;
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (objnum && parser_objnum != objnum)
return nullptr;
@@ -803,7 +803,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
if (!bIsNumber)
return nullptr;
- FX_DWORD gennum = FXSYS_atoui(word);
+ uint32_t gennum = FXSYS_atoui(word);
if (m_syntaxParser.GetKeyword() != "obj") {
m_syntaxParser.RestorePos(SavedPos);
return nullptr;
@@ -816,7 +816,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
}
IPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() {
- FX_DWORD req_size = 1024;
+ uint32_t req_size = 1024;
if (!m_pFileAvail->IsDataAvail(0, req_size))
return LinearizationUnknown;
@@ -834,7 +834,7 @@ IPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() {
return NotLinearized;
}
-FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
+FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE));
int32_t offset = GetHeaderOffset(file.get());
@@ -852,7 +852,7 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
if (!bNumber)
return FALSE;
- FX_DWORD objnum = FXSYS_atoui(wordObjNum);
+ uint32_t objnum = FXSYS_atoui(wordObjNum);
if (m_pLinearized) {
m_pLinearized->Release();
m_pLinearized = nullptr;
@@ -883,8 +883,8 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
}
FX_BOOL CPDF_DataAvail::CheckEnd(IPDF_DataAvail::DownloadHints* pHints) {
- FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
- FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos);
+ uint32_t req_pos = (uint32_t)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
+ uint32_t dwSize = (uint32_t)(m_dwFileLen - req_pos);
if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) {
uint8_t buffer[1024];
@@ -928,8 +928,8 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(
IPDF_DataAvail::DownloadHints* pHints,
FX_FILESIZE& xref_offset) {
xref_offset = 0;
- FX_DWORD req_size =
- (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ uint32_t req_size =
+ (uint32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) {
int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam);
@@ -946,7 +946,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(
if (!bNumber)
return -1;
- FX_DWORD objNum = FXSYS_atoui(objnum);
+ uint32_t objNum = FXSYS_atoui(objnum);
CPDF_Object* pObj = m_parser.ParseIndirectObjectAt(nullptr, 0, objNum);
if (!pObj) {
m_Pos += m_parser.m_pSyntax->SavePos();
@@ -997,7 +997,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
}
uint8_t buffer[256];
- FX_DWORD index = 0;
+ uint32_t index = 0;
if (PDFCharIsDelimiter(ch)) {
buffer[index++] = ch;
if (ch == '/') {
@@ -1063,9 +1063,9 @@ FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t& ch) {
if (m_bufferOffset >= pos ||
(FX_FILESIZE)(m_bufferOffset + m_bufferSize) <= pos) {
FX_FILESIZE read_pos = pos;
- FX_DWORD read_size = 512;
+ uint32_t read_size = 512;
if ((FX_FILESIZE)read_size > m_dwFileLen)
- read_size = (FX_DWORD)m_dwFileLen;
+ read_size = (uint32_t)m_dwFileLen;
if ((FX_FILESIZE)(read_pos + read_size) > m_dwFileLen)
read_pos = m_dwFileLen - read_size;
@@ -1210,7 +1210,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IPDF_DataAvail::DownloadHints* pHints) {
return TRUE;
}
- FX_DWORD xrefpos = GetDirectInteger(pTrailerDict, "Prev");
+ uint32_t xrefpos = GetDirectInteger(pTrailerDict, "Prev");
if (xrefpos) {
m_dwPrevXRefOffset = GetDirectInteger(pTrailerDict, "XRefStm");
if (m_dwPrevXRefOffset) {
@@ -1259,7 +1259,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage,
}
FX_BOOL CPDF_DataAvail::CheckArrayPageNode(
- FX_DWORD dwPageNo,
+ uint32_t dwPageNo,
CPDF_DataAvail::PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints) {
FX_BOOL bExist = FALSE;
@@ -1285,7 +1285,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(
}
pPageNode->m_type = PDF_PAGENODE_PAGES;
- for (FX_DWORD i = 0; i < pArray->GetCount(); ++i) {
+ for (uint32_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Reference* pKid = ToReference(pArray->GetElement(i));
if (!pKid)
continue;
@@ -1299,7 +1299,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(
}
FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(
- FX_DWORD dwPageNo,
+ uint32_t dwPageNo,
CPDF_DataAvail::PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints) {
FX_BOOL bExist = FALSE;
@@ -1348,7 +1348,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(
} break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
- for (FX_DWORD i = 0; i < pKidsArray->GetCount(); ++i) {
+ for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) {
CPDF_Reference* pKid = ToReference(pKidsArray->GetElement(i));
if (!pKid)
continue;
@@ -1623,7 +1623,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
return DataAvailable;
if (m_bLinearized) {
- if ((FX_DWORD)iPage == m_dwFirstPageNo) {
+ if ((uint32_t)iPage == m_dwFirstPageNo) {
DocAvailStatus nRet = CheckLinearizedFirstPage(iPage, pHints);
if (nRet == DataAvailable)
m_pagesLoadState.insert(iPage);
@@ -1753,11 +1753,11 @@ FX_BOOL CPDF_DataAvail::CheckResources(IPDF_DataAvail::DownloadHints* pHints) {
}
void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos,
- FX_DWORD* pSize) {
+ uint32_t* pSize) {
if (pPos)
*pPos = m_dwLastXRefOffset;
if (pSize)
- *pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset);
+ *pSize = (uint32_t)(m_dwFileLen - m_dwLastXRefOffset);
}
int CPDF_DataAvail::GetPageCount() const {
@@ -1781,13 +1781,13 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) {
if (m_pHintTables && index != pageNum) {
FX_FILESIZE szPageStartPos = 0;
FX_FILESIZE szPageLength = 0;
- FX_DWORD dwObjNum = 0;
+ uint32_t dwObjNum = 0;
FX_BOOL bPagePosGot = m_pHintTables->GetPagePos(index, szPageStartPos,
szPageLength, dwObjNum);
if (!bPagePosGot)
return nullptr;
- m_syntaxParser.InitParser(m_pFileRead, (FX_DWORD)szPageStartPos);
+ m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos);
CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument);
if (!pPageDict)
return nullptr;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h
index 036de72968..f7da8f0d22 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h
@@ -63,7 +63,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
DocFormStatus IsFormAvail(DownloadHints* pHints) override;
DocLinearizationStatus IsLinearizedPDF() override;
FX_BOOL IsLinearized() override { return m_bLinearized; }
- void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, FX_DWORD* pSize) override;
+ void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize) override;
int GetPageCount() const;
CPDF_Dictionary* GetPage(int index);
@@ -77,7 +77,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
~PageNode();
PDF_PAGENODE_TYPE m_type;
- FX_DWORD m_dwPageNo;
+ uint32_t m_dwPageNo;
CFX_ArrayTemplate<PageNode*> m_childNode;
};
@@ -85,7 +85,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
static int s_CurrentDataAvailRecursionDepth;
static const int kMaxPageRecursionDepth = 1024;
- FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset);
+ uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset);
FX_BOOL IsObjectsAvail(CFX_ArrayTemplate<CPDF_Object*>& obj_array,
FX_BOOL bParsePage,
IPDF_DataAvail::DownloadHints* pHints,
@@ -112,15 +112,15 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
int32_t CheckCrossRefStream(IPDF_DataAvail::DownloadHints* pHints,
FX_FILESIZE& xref_offset);
- FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen);
+ FX_BOOL IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
FX_BOOL GetNextToken(CFX_ByteString& token);
FX_BOOL GetNextChar(uint8_t& ch);
CPDF_Object* ParseIndirectObjectAt(
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
CPDF_IndirectObjectHolder* pObjList = nullptr);
- CPDF_Object* GetObject(FX_DWORD objnum,
+ CPDF_Object* GetObject(uint32_t objnum,
IPDF_DataAvail::DownloadHints* pHints,
FX_BOOL* pExistInFile);
FX_BOOL GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages);
@@ -143,24 +143,24 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
int32_t& iCount,
IPDF_DataAvail::DownloadHints* pHints,
int level);
- FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo,
+ FX_BOOL CheckUnkownPageNode(uint32_t dwPageNo,
PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints);
- FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo,
+ FX_BOOL CheckArrayPageNode(uint32_t dwPageNo,
PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints);
FX_BOOL CheckPageCount(IPDF_DataAvail::DownloadHints* pHints);
bool IsFirstCheck(int iPage);
void ResetFirstCheck(int iPage);
FX_BOOL IsDataAvail(FX_FILESIZE offset,
- FX_DWORD size,
+ uint32_t size,
IPDF_DataAvail::DownloadHints* pHints);
CPDF_Parser m_parser;
CPDF_SyntaxParser m_syntaxParser;
CPDF_Object* m_pRoot;
- FX_DWORD m_dwRootObjNum;
- FX_DWORD m_dwInfoObjNum;
+ uint32_t m_dwRootObjNum;
+ uint32_t m_dwInfoObjNum;
CPDF_Object* m_pLinearized;
CPDF_Object* m_pTrailer;
FX_BOOL m_bDocAvail;
@@ -172,18 +172,18 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
PDF_DATAAVAIL_STATUS m_docStatus;
FX_FILESIZE m_dwFileLen;
CPDF_Document* m_pDocument;
- std::set<FX_DWORD> m_ObjectSet;
+ std::set<uint32_t> m_ObjectSet;
CFX_ArrayTemplate<CPDF_Object*> m_objs_array;
FX_FILESIZE m_Pos;
FX_FILESIZE m_bufferOffset;
- FX_DWORD m_bufferSize;
+ uint32_t m_bufferSize;
CFX_ByteString m_WordBuf;
uint8_t m_bufferData[512];
- CFX_ArrayTemplate<FX_DWORD> m_XRefStreamList;
- CFX_ArrayTemplate<FX_DWORD> m_PageObjList;
- FX_DWORD m_PagesObjNum;
+ CFX_ArrayTemplate<uint32_t> m_XRefStreamList;
+ CFX_ArrayTemplate<uint32_t> m_PageObjList;
+ uint32_t m_PagesObjNum;
FX_BOOL m_bLinearized;
- FX_DWORD m_dwFirstPageNo;
+ uint32_t m_dwFirstPageNo;
FX_BOOL m_bLinearedDataOK;
FX_BOOL m_bMainXRefLoadTried;
FX_BOOL m_bMainXRefLoadedOK;
@@ -193,7 +193,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
FX_FILESIZE m_dwCurrentXRefSteam;
FX_BOOL m_bAnnotsLoad;
FX_BOOL m_bHaveAcroForm;
- FX_DWORD m_dwAcroFormObjNum;
+ uint32_t m_dwAcroFormObjNum;
FX_BOOL m_bAcroFormLoad;
CPDF_Object* m_pAcroForm;
CFX_ArrayTemplate<CPDF_Object*> m_arrayAcroforms;
@@ -203,13 +203,13 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
FX_BOOL m_bPageLoadedOK;
FX_BOOL m_bLinearizedFormParamLoad;
CFX_ArrayTemplate<CPDF_Object*> m_PagesArray;
- FX_DWORD m_dwEncryptObjNum;
+ uint32_t m_dwEncryptObjNum;
FX_FILESIZE m_dwPrevXRefOffset;
FX_BOOL m_bTotalLoadPageTree;
FX_BOOL m_bCurPageDictLoadOK;
PageNode m_pageNodes;
- std::set<FX_DWORD> m_pageMapCheckState;
- std::set<FX_DWORD> m_pagesLoadState;
+ std::set<uint32_t> m_pageMapCheckState;
+ std::set<uint32_t> m_pagesLoadState;
std::unique_ptr<CPDF_HintTables> m_pHintTables;
FX_BOOL m_bSupportHintTable;
};
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
index 0155c43bb8..75730e5754 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
@@ -229,13 +229,13 @@ void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key,
void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum) {
+ uint32_t objnum) {
SetAt(key, new CPDF_Reference(pDoc, objnum));
}
void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum) {
+ uint32_t objnum) {
SetAt(key, new CPDF_Reference(pDoc, objnum));
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index eb9a483e6e..9ed8b3fac6 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -32,7 +32,7 @@ int CountPages(CPDF_Dictionary* pPages,
return 0;
}
count = 0;
- for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
+ for (uint32_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) {
continue;
@@ -114,7 +114,7 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_ID1 = pIDArray->GetStringAt(0);
m_ID2 = pIDArray->GetStringAt(1);
}
- FX_DWORD dwPageCount = 0;
+ uint32_t dwPageCount = 0;
CPDF_Object* pCount = pLinearized->GetElement("N");
if (ToNumber(pCount))
dwPageCount = pCount->GetInteger();
@@ -216,8 +216,8 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
}
int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
- FX_DWORD& skip_count,
- FX_DWORD objnum,
+ uint32_t& skip_count,
+ uint32_t objnum,
int& index,
int level) {
if (pNode->KeyExist("Kids")) {
@@ -228,14 +228,14 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
if (level >= FX_MAX_PAGE_LEVEL) {
return -1;
}
- FX_DWORD count = pNode->GetIntegerBy("Count");
+ uint32_t count = pNode->GetIntegerBy("Count");
if (count <= skip_count) {
skip_count -= count;
index += count;
return -1;
}
if (count && count == pKidList->GetCount()) {
- for (FX_DWORD i = 0; i < count; i++) {
+ for (uint32_t i = 0; i < count; i++) {
if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) {
if (pKid->GetRefObjNum() == objnum) {
m_PageList.SetAt(index + i, objnum);
@@ -244,7 +244,7 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
}
}
}
- for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
+ for (uint32_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid) {
continue;
@@ -269,12 +269,12 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
}
return -1;
}
-int CPDF_Document::GetPageIndex(FX_DWORD objnum) {
- FX_DWORD nPages = m_PageList.GetSize();
- FX_DWORD skip_count = 0;
+int CPDF_Document::GetPageIndex(uint32_t objnum) {
+ uint32_t nPages = m_PageList.GetSize();
+ uint32_t skip_count = 0;
FX_BOOL bSkipped = FALSE;
- for (FX_DWORD i = 0; i < nPages; i++) {
- FX_DWORD objnum1 = m_PageList.GetAt(i);
+ for (uint32_t i = 0; i < nPages; i++) {
+ uint32_t objnum1 = m_PageList.GetAt(i);
if (objnum1 == objnum) {
return i;
}
@@ -315,14 +315,14 @@ int CPDF_Document::RetrievePageCount() const {
return CountPages(pPages, &visited_pages);
}
-FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
+uint32_t CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
if (!m_pParser) {
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
}
return m_pParser->GetPermissions(bCheckRevision);
}
-FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
+FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const {
auto it = m_IndirectObjs.find(objnum);
if (it != m_IndirectObjs.end()) {
CPDF_Stream* pStream = it->second->AsStream();
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index eafda43965..dd2be01311 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -30,7 +30,7 @@ CPDF_HintTables::~CPDF_HintTables() {
m_dwIdentifierArray.RemoveAll();
}
-FX_DWORD CPDF_HintTables::GetItemLength(
+uint32_t CPDF_HintTables::GetItemLength(
int index,
const std::vector<FX_FILESIZE>& szArray) {
if (index < 0 || szArray.size() < 2 ||
@@ -50,17 +50,17 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
if (nStreamOffset < 0 || nStreamLen < 1)
return FALSE;
- const FX_DWORD kHeaderSize = 288;
+ const uint32_t kHeaderSize = 288;
if (hStream->BitsRemaining() < kHeaderSize)
return FALSE;
// Item 1: The least number of objects in a page.
- FX_DWORD dwObjLeastNum = hStream->GetBits(32);
+ uint32_t dwObjLeastNum = hStream->GetBits(32);
// Item 2: The location of the first page's page object.
- FX_DWORD dwFirstObjLoc = hStream->GetBits(32);
+ uint32_t dwFirstObjLoc = hStream->GetBits(32);
if (dwFirstObjLoc > nStreamOffset) {
- FX_SAFE_DWORD safeLoc = pdfium::base::checked_cast<FX_DWORD>(nStreamLen);
+ FX_SAFE_DWORD safeLoc = pdfium::base::checked_cast<uint32_t>(nStreamLen);
safeLoc += dwFirstObjLoc;
if (!safeLoc.IsValid())
return FALSE;
@@ -73,31 +73,31 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
// Item 3: The number of bits needed to represent the difference
// between the greatest and least number of objects in a page.
- FX_DWORD dwDeltaObjectsBits = hStream->GetBits(16);
+ uint32_t dwDeltaObjectsBits = hStream->GetBits(16);
// Item 4: The least length of a page in bytes.
- FX_DWORD dwPageLeastLen = hStream->GetBits(32);
+ uint32_t dwPageLeastLen = hStream->GetBits(32);
// Item 5: The number of bits needed to represent the difference
// between the greatest and least length of a page, in bytes.
- FX_DWORD dwDeltaPageLenBits = hStream->GetBits(16);
+ uint32_t dwDeltaPageLenBits = hStream->GetBits(16);
// Skip Item 6, 7, 8, 9 total 96 bits.
hStream->SkipBits(96);
// Item 10: The number of bits needed to represent the greatest
// number of shared object references.
- FX_DWORD dwSharedObjBits = hStream->GetBits(16);
+ uint32_t dwSharedObjBits = hStream->GetBits(16);
// Item 11: The number of bits needed to represent the numerically
// greatest shared object identifier used by the pages.
- FX_DWORD dwSharedIdBits = hStream->GetBits(16);
+ uint32_t dwSharedIdBits = hStream->GetBits(16);
// Item 12: The number of bits needed to represent the numerator of
// the fractional position for each shared object reference. For each
// shared object referenced from a page, there is an indication of
// where in the page's content stream the object is first referenced.
- FX_DWORD dwSharedNumeratorBits = hStream->GetBits(16);
+ uint32_t dwSharedNumeratorBits = hStream->GetBits(16);
// Item 13: Skip Item 13 which has 16 bits.
hStream->SkipBits(16);
@@ -108,7 +108,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
return FALSE;
FX_SAFE_DWORD required_bits = dwDeltaObjectsBits;
- required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages);
+ required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
@@ -122,11 +122,11 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
hStream->ByteAlign();
required_bits = dwDeltaPageLenBits;
- required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages);
+ required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
- CFX_ArrayTemplate<FX_DWORD> dwPageLenArray;
+ CFX_ArrayTemplate<uint32_t> dwPageLenArray;
for (int i = 0; i < nPages; ++i) {
FX_SAFE_DWORD safePageLen = hStream->GetBits(dwDeltaPageLenBits);
safePageLen += dwPageLeastLen;
@@ -170,7 +170,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
// Number of shared objects.
required_bits = dwSharedObjBits;
- required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages);
+ required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
@@ -200,7 +200,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
}
hStream->ByteAlign();
- FX_SAFE_DWORD safeTotalPageLen = pdfium::base::checked_cast<FX_DWORD>(nPages);
+ FX_SAFE_DWORD safeTotalPageLen = pdfium::base::checked_cast<uint32_t>(nPages);
safeTotalPageLen *= dwDeltaPageLenBits;
if (!CanReadFromBitStream(hStream, safeTotalPageLen))
return FALSE;
@@ -211,7 +211,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
}
FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
- FX_DWORD offset) {
+ uint32_t offset) {
if (!hStream || hStream->IsEOF())
return FALSE;
@@ -226,16 +226,16 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
return FALSE;
hStream->SkipBits(bit_offset.ValueOrDie() - hStream->GetPos());
- const FX_DWORD kHeaderSize = 192;
+ const uint32_t kHeaderSize = 192;
if (hStream->BitsRemaining() < kHeaderSize)
return FALSE;
// Item 1: The object number of the first object in the shared objects
// section.
- FX_DWORD dwFirstSharedObjNum = hStream->GetBits(32);
+ uint32_t dwFirstSharedObjNum = hStream->GetBits(32);
// Item 2: The location of the first object in the shared objects section.
- FX_DWORD dwFirstSharedObjLoc = hStream->GetBits(32);
+ uint32_t dwFirstSharedObjLoc = hStream->GetBits(32);
if (dwFirstSharedObjLoc > nStreamOffset)
dwFirstSharedObjLoc += nStreamLen;
@@ -244,31 +244,31 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
// Item 4: The number of shared object entries for the shared objects
// section, including the number of shared object entries for the first page.
- FX_DWORD dwSharedObjTotal = hStream->GetBits(32);
+ uint32_t dwSharedObjTotal = hStream->GetBits(32);
// Item 5: The number of bits needed to represent the greatest number of
// objects in a shared object group. Skipped.
hStream->SkipBits(16);
// Item 6: The least length of a shared object group in bytes.
- FX_DWORD dwGroupLeastLen = hStream->GetBits(32);
+ uint32_t dwGroupLeastLen = hStream->GetBits(32);
// Item 7: The number of bits needed to represent the difference between the
// greatest and least length of a shared object group, in bytes.
- FX_DWORD dwDeltaGroupLen = hStream->GetBits(16);
+ uint32_t dwDeltaGroupLen = hStream->GetBits(16);
CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O");
int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1;
if (nFirstPageObjNum < 0)
return FALSE;
- FX_DWORD dwPrevObjLen = 0;
- FX_DWORD dwCurObjLen = 0;
+ uint32_t dwPrevObjLen = 0;
+ uint32_t dwCurObjLen = 0;
FX_SAFE_DWORD required_bits = dwSharedObjTotal;
required_bits *= dwDeltaGroupLen;
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
- for (FX_DWORD i = 0; i < dwSharedObjTotal; ++i) {
+ for (uint32_t i = 0; i < dwSharedObjTotal; ++i) {
dwPrevObjLen = dwCurObjLen;
FX_SAFE_DWORD safeObjLen = hStream->GetBits(dwDeltaGroupLen);
safeObjLen += dwGroupLeastLen;
@@ -324,7 +324,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
FX_BOOL CPDF_HintTables::GetPagePos(int index,
FX_FILESIZE& szPageStartPos,
FX_FILESIZE& szPageLength,
- FX_DWORD& dwObjNum) {
+ uint32_t& dwObjNum) {
if (!m_pLinearizedDict)
return FALSE;
@@ -365,7 +365,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage(
if (index == nFirstAvailPage)
return IPDF_DataAvail::DataAvailable;
- FX_DWORD dwLength = GetItemLength(index, m_szPageOffsetArray);
+ uint32_t dwLength = GetItemLength(index, m_szPageOffsetArray);
// If two pages have the same offset, it should be treated as an error.
if (!dwLength)
return IPDF_DataAvail::DataError;
@@ -374,7 +374,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage(
return IPDF_DataAvail::DataNotAvailable;
// Download data of shared objects in the page.
- FX_DWORD offset = 0;
+ uint32_t offset = 0;
for (int i = 0; i < index; ++i)
offset += m_dwNSharedObjsArray[i];
@@ -383,8 +383,8 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage(
if (nFirstPageObjNum < 0)
return IPDF_DataAvail::DataError;
- FX_DWORD dwIndex = 0;
- FX_DWORD dwObjNum = 0;
+ uint32_t dwIndex = 0;
+ uint32_t dwObjNum = 0;
for (int j = 0; j < m_dwNSharedObjsArray[index]; ++j) {
dwIndex = m_dwIdentifierArray[offset + j];
if (dwIndex >= m_dwSharedObjNumArray.GetSize())
@@ -422,11 +422,11 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
CPDF_StreamAcc acc;
acc.LoadAllData(pHintStream);
- FX_DWORD size = acc.GetSize();
+ uint32_t size = acc.GetSize();
// The header section of page offset hint table is 36 bytes.
// The header section of shared object hint table is 24 bytes.
// Hint table has at least 60 bytes.
- const FX_DWORD MIN_STREAM_LEN = 60;
+ const uint32_t MIN_STREAM_LEN = 60;
if (size < MIN_STREAM_LEN || shared_hint_table_offset <= 0 ||
size < shared_hint_table_offset) {
return FALSE;
@@ -435,7 +435,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
CFX_BitStream bs;
bs.Init(acc.GetData(), size);
return ReadPageHintTable(&bs) &&
- ReadSharedObjHintTable(&bs, pdfium::base::checked_cast<FX_DWORD>(
+ ReadSharedObjHintTable(&bs, pdfium::base::checked_cast<uint32_t>(
shared_hint_table_offset));
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h
index f6f862fab6..28ccccb6fc 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h
@@ -30,7 +30,7 @@ class CPDF_HintTables {
FX_BOOL GetPagePos(int index,
FX_FILESIZE& szPageStartPos,
FX_FILESIZE& szPageLength,
- FX_DWORD& dwObjNum);
+ uint32_t& dwObjNum);
IPDF_DataAvail::DocAvailStatus CheckPage(
int index,
@@ -40,8 +40,8 @@ class CPDF_HintTables {
protected:
FX_BOOL ReadPageHintTable(CFX_BitStream* hStream);
- FX_BOOL ReadSharedObjHintTable(CFX_BitStream* hStream, FX_DWORD offset);
- FX_DWORD GetItemLength(int index, const std::vector<FX_FILESIZE>& szArray);
+ FX_BOOL ReadSharedObjHintTable(CFX_BitStream* hStream, uint32_t offset);
+ uint32_t GetItemLength(int index, const std::vector<FX_FILESIZE>& szArray);
private:
int ReadPrimaryHintStreamOffset() const;
@@ -49,12 +49,12 @@ class CPDF_HintTables {
CPDF_Dictionary* m_pLinearizedDict;
CPDF_DataAvail* m_pDataAvail;
- FX_DWORD m_nFirstPageSharedObjs;
+ uint32_t m_nFirstPageSharedObjs;
FX_FILESIZE m_szFirstPageObjOffset;
- CFX_ArrayTemplate<FX_DWORD> m_dwDeltaNObjsArray;
- CFX_ArrayTemplate<FX_DWORD> m_dwNSharedObjsArray;
- CFX_ArrayTemplate<FX_DWORD> m_dwSharedObjNumArray;
- CFX_ArrayTemplate<FX_DWORD> m_dwIdentifierArray;
+ CFX_ArrayTemplate<uint32_t> m_dwDeltaNObjsArray;
+ CFX_ArrayTemplate<uint32_t> m_dwNSharedObjsArray;
+ CFX_ArrayTemplate<uint32_t> m_dwSharedObjNumArray;
+ CFX_ArrayTemplate<uint32_t> m_dwIdentifierArray;
std::vector<FX_FILESIZE> m_szPageOffsetArray;
std::vector<FX_FILESIZE> m_szSharedObjOffsetArray;
};
diff --git a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp
index 1de1ef2252..14410dabb5 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp
@@ -20,7 +20,7 @@ CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() {
pair.second->Destroy();
}
-CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(FX_DWORD objnum) {
+CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(uint32_t objnum) {
if (objnum == 0)
return nullptr;
@@ -44,7 +44,7 @@ CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(FX_DWORD objnum) {
return pObj;
}
-FX_DWORD CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) {
+uint32_t CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) {
if (pObj->m_ObjNum)
return pObj->m_ObjNum;
@@ -54,7 +54,7 @@ FX_DWORD CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) {
return m_LastObjNum;
}
-void CPDF_IndirectObjectHolder::ReleaseIndirectObject(FX_DWORD objnum) {
+void CPDF_IndirectObjectHolder::ReleaseIndirectObject(uint32_t objnum) {
auto it = m_IndirectObjs.find(objnum);
if (it == m_IndirectObjs.end() || it->second->GetObjNum() == -1)
return;
@@ -62,7 +62,7 @@ void CPDF_IndirectObjectHolder::ReleaseIndirectObject(FX_DWORD objnum) {
m_IndirectObjs.erase(it);
}
-FX_BOOL CPDF_IndirectObjectHolder::InsertIndirectObject(FX_DWORD objnum,
+FX_BOOL CPDF_IndirectObjectHolder::InsertIndirectObject(uint32_t objnum,
CPDF_Object* pObj) {
if (!objnum || !pObj)
return FALSE;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
index 5312e62d43..bebd3d62be 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -31,10 +31,10 @@ const int32_t kMaxXRefSize = 1048576;
// A limit on the maximum object number in the xref table. Theoretical limits
// are higher, but this may be large enough in practice.
-const FX_DWORD kMaxObjectNumber = 1048576;
+const uint32_t kMaxObjectNumber = 1048576;
-FX_DWORD GetVarInt(const uint8_t* p, int32_t n) {
- FX_DWORD result = 0;
+uint32_t GetVarInt(const uint8_t* p, int32_t n) {
+ uint32_t result = 0;
for (int32_t i = 0; i < n; ++i)
result = result * 256 + p[i];
return result;
@@ -67,32 +67,32 @@ CPDF_Parser::~CPDF_Parser() {
CloseParser();
}
-FX_DWORD CPDF_Parser::GetLastObjNum() const {
+uint32_t CPDF_Parser::GetLastObjNum() const {
return m_ObjectInfo.empty() ? 0 : m_ObjectInfo.rbegin()->first;
}
-bool CPDF_Parser::IsValidObjectNumber(FX_DWORD objnum) const {
+bool CPDF_Parser::IsValidObjectNumber(uint32_t objnum) const {
return !m_ObjectInfo.empty() && objnum <= m_ObjectInfo.rbegin()->first;
}
-FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero(FX_DWORD objnum) const {
+FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero(uint32_t objnum) const {
auto it = m_ObjectInfo.find(objnum);
return it != m_ObjectInfo.end() ? it->second.pos : 0;
}
-uint8_t CPDF_Parser::GetObjectType(FX_DWORD objnum) const {
+uint8_t CPDF_Parser::GetObjectType(uint32_t objnum) const {
ASSERT(IsValidObjectNumber(objnum));
auto it = m_ObjectInfo.find(objnum);
return it != m_ObjectInfo.end() ? it->second.type : 0;
}
-uint16_t CPDF_Parser::GetObjectGenNum(FX_DWORD objnum) const {
+uint16_t CPDF_Parser::GetObjectGenNum(uint32_t objnum) const {
ASSERT(IsValidObjectNumber(objnum));
auto it = m_ObjectInfo.find(objnum);
return it != m_ObjectInfo.end() ? it->second.gennum : 0;
}
-bool CPDF_Parser::IsObjectFreeOrNull(FX_DWORD objnum) const {
+bool CPDF_Parser::IsObjectFreeOrNull(uint32_t objnum) const {
uint8_t type = GetObjectType(objnum);
return type == 0 || type == 255;
}
@@ -109,7 +109,7 @@ IFX_FileRead* CPDF_Parser::GetFileAccess() const {
return m_pSyntax->m_pFileAccess;
}
-void CPDF_Parser::ShrinkObjectMap(FX_DWORD objnum) {
+void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) {
if (objnum == 0) {
m_ObjectInfo.clear();
return;
@@ -302,7 +302,7 @@ void CPDF_Parser::ReleaseEncryptHandler() {
m_pSecurityHandler.reset();
}
-FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) const {
+FX_FILESIZE CPDF_Parser::GetObjectOffset(uint32_t objnum) const {
if (!IsValidObjectNumber(objnum))
return 0;
@@ -371,7 +371,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
}
FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
- FX_DWORD dwObjCount) {
+ uint32_t dwObjCount) {
if (!LoadLinearizedCrossRefV4(xrefpos, dwObjCount))
return FALSE;
@@ -424,14 +424,14 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
}
FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
- FX_DWORD dwObjCount) {
+ uint32_t dwObjCount) {
FX_FILESIZE dwStartPos = pos - m_pSyntax->m_HeaderOffset;
m_pSyntax->RestorePos(dwStartPos);
m_SortedOffset.insert(pos);
- FX_DWORD start_objnum = 0;
- FX_DWORD count = dwObjCount;
+ uint32_t start_objnum = 0;
+ uint32_t count = dwObjCount;
FX_FILESIZE SavedPos = m_pSyntax->SavePos();
const int32_t recordsize = 20;
@@ -441,7 +441,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
int32_t nBlocks = count / 1024 + 1;
for (int32_t block = 0; block < nBlocks; block++) {
int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
- FX_DWORD dwReadSize = block_size * recordsize;
+ uint32_t dwReadSize = block_size * recordsize;
if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_pSyntax->m_FileLen)
return FALSE;
@@ -451,7 +451,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
}
for (int32_t i = 0; i < block_size; i++) {
- FX_DWORD objnum = start_objnum + block * 1024 + i;
+ uint32_t objnum = start_objnum + block * 1024 + i;
char* pEntry = &buf[i * recordsize];
if (pEntry[17] == 'f') {
m_ObjectInfo[objnum].pos = 0;
@@ -505,11 +505,11 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
break;
}
- FX_DWORD start_objnum = FXSYS_atoui(word);
+ uint32_t start_objnum = FXSYS_atoui(word);
if (start_objnum >= kMaxObjectNumber)
return false;
- FX_DWORD count = m_pSyntax->GetDirectNum();
+ uint32_t count = m_pSyntax->GetDirectNum();
m_pSyntax->ToNextWord();
SavedPos = m_pSyntax->SavePos();
const int32_t recordsize = 20;
@@ -526,7 +526,7 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
block_size * recordsize);
for (int32_t i = 0; i < block_size; i++) {
- FX_DWORD objnum = start_objnum + block * 1024 + i;
+ uint32_t objnum = start_objnum + block * 1024 + i;
char* pEntry = &buf[i * recordsize];
if (pEntry[17] == 'f') {
m_ObjectInfo[objnum].pos = 0;
@@ -589,11 +589,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
ParserState state = ParserState::kDefault;
int32_t inside_index = 0;
- FX_DWORD objnum = 0;
- FX_DWORD gennum = 0;
+ uint32_t objnum = 0;
+ uint32_t gennum = 0;
int32_t depth = 0;
- const FX_DWORD kBufferSize = 4096;
+ const uint32_t kBufferSize = 4096;
std::vector<uint8_t> buffer(kBufferSize);
FX_FILESIZE pos = m_pSyntax->m_HeaderOffset;
@@ -606,12 +606,12 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
while (pos < m_pSyntax->m_FileLen) {
const FX_FILESIZE saved_pos = pos;
bool bOverFlow = false;
- FX_DWORD size =
- std::min((FX_DWORD)(m_pSyntax->m_FileLen - pos), kBufferSize);
+ uint32_t size =
+ std::min((uint32_t)(m_pSyntax->m_FileLen - pos), kBufferSize);
if (!m_pSyntax->m_pFileAccess->ReadBlock(buffer.data(), pos, size))
break;
- for (FX_DWORD i = 0; i < size; i++) {
+ for (uint32_t i = 0; i < size; i++) {
uint8_t byte = buffer[i];
switch (state) {
case ParserState::kDefault:
@@ -763,17 +763,17 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
offset += 3;
FX_FILESIZE nLen = obj_end - obj_pos - offset;
- if ((FX_DWORD)nLen > size - i) {
+ if ((uint32_t)nLen > size - i) {
pos = obj_end + m_pSyntax->m_HeaderOffset;
bOverFlow = true;
} else {
- i += (FX_DWORD)nLen;
+ i += (uint32_t)nLen;
}
if (!m_ObjectInfo.empty() && IsValidObjectNumber(objnum) &&
m_ObjectInfo[objnum].pos) {
if (pObject) {
- FX_DWORD oldgen = GetObjectGenNum(objnum);
+ uint32_t oldgen = GetObjectGenNum(objnum);
m_ObjectInfo[objnum].pos = obj_pos;
m_ObjectInfo[objnum].gennum = gennum;
if (oldgen != gennum)
@@ -819,7 +819,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
const CFX_ByteString& key = it->first;
CPDF_Object* pElement = it->second;
++it;
- FX_DWORD dwObjNum =
+ uint32_t dwObjNum =
pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
m_pTrailer->SetAtReference(key, m_pDocument,
@@ -987,8 +987,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
std::vector<std::pair<int32_t, int32_t>> arrIndex;
CPDF_Array* pArray = pStream->GetDict()->GetArrayBy("Index");
if (pArray) {
- FX_DWORD nPairSize = pArray->GetCount() / 2;
- for (FX_DWORD i = 0; i < nPairSize; i++) {
+ uint32_t nPairSize = pArray->GetCount() / 2;
+ for (uint32_t i = 0; i < nPairSize; i++) {
CPDF_Object* pStartNumObj = pArray->GetElement(i * 2);
CPDF_Object* pCountObj = pArray->GetElement(i * 2 + 1);
@@ -1010,9 +1010,9 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
return FALSE;
}
- CFX_ArrayTemplate<FX_DWORD> WidthArray;
+ CFX_ArrayTemplate<uint32_t> WidthArray;
FX_SAFE_DWORD dwAccWidth = 0;
- for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
+ for (uint32_t i = 0; i < pArray->GetCount(); i++) {
WidthArray.Add(pArray->GetIntegerAt(i));
dwAccWidth += WidthArray[i];
}
@@ -1022,22 +1022,22 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
return FALSE;
}
- FX_DWORD totalWidth = dwAccWidth.ValueOrDie();
+ uint32_t totalWidth = dwAccWidth.ValueOrDie();
CPDF_StreamAcc acc;
acc.LoadAllData(pStream);
const uint8_t* pData = acc.GetData();
- FX_DWORD dwTotalSize = acc.GetSize();
- FX_DWORD segindex = 0;
- for (FX_DWORD i = 0; i < arrIndex.size(); i++) {
+ uint32_t dwTotalSize = acc.GetSize();
+ uint32_t segindex = 0;
+ for (uint32_t i = 0; i < arrIndex.size(); i++) {
int32_t startnum = arrIndex[i].first;
if (startnum < 0)
continue;
m_dwXrefStartObjNum =
- pdfium::base::checked_cast<FX_DWORD, int32_t>(startnum);
- FX_DWORD count =
- pdfium::base::checked_cast<FX_DWORD, int32_t>(arrIndex[i].second);
+ pdfium::base::checked_cast<uint32_t, int32_t>(startnum);
+ uint32_t count =
+ pdfium::base::checked_cast<uint32_t, int32_t>(arrIndex[i].second);
FX_SAFE_DWORD dwCaculatedSize = segindex;
dwCaculatedSize += count;
dwCaculatedSize *= totalWidth;
@@ -1049,11 +1049,11 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
const uint8_t* segstart = pData + segindex * totalWidth;
FX_SAFE_DWORD dwMaxObjNum = startnum;
dwMaxObjNum += count;
- FX_DWORD dwV5Size = m_ObjectInfo.empty() ? 0 : GetLastObjNum() + 1;
+ uint32_t dwV5Size = m_ObjectInfo.empty() ? 0 : GetLastObjNum() + 1;
if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size)
continue;
- for (FX_DWORD j = 0; j < count; j++) {
+ for (uint32_t j = 0; j < count; j++) {
int32_t type = 1;
const uint8_t* entrystart = segstart + j * totalWidth;
if (WidthArray[0])
@@ -1106,19 +1106,19 @@ CPDF_Array* CPDF_Parser::GetIDArray() {
return ToArray(pID);
}
-FX_DWORD CPDF_Parser::GetRootObjNum() {
+uint32_t CPDF_Parser::GetRootObjNum() {
CPDF_Reference* pRef =
ToReference(m_pTrailer ? m_pTrailer->GetElement("Root") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
-FX_DWORD CPDF_Parser::GetInfoObjNum() {
+uint32_t CPDF_Parser::GetInfoObjNum() {
CPDF_Reference* pRef =
ToReference(m_pTrailer ? m_pTrailer->GetElement("Info") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
-FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
+FX_BOOL CPDF_Parser::IsFormStream(uint32_t objnum, FX_BOOL& bForm) {
bForm = FALSE;
if (!IsValidObjectNumber(objnum))
return TRUE;
@@ -1150,7 +1150,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
CPDF_Object* CPDF_Parser::ParseIndirectObject(
CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum) {
+ uint32_t objnum) {
if (!IsValidObjectNumber(objnum))
return nullptr;
@@ -1158,7 +1158,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
if (pdfium::ContainsKey(m_ParsingObjNums, objnum))
return nullptr;
- pdfium::ScopedSetInsertion<FX_DWORD> local_insert(&m_ParsingObjNums, objnum);
+ pdfium::ScopedSetInsertion<uint32_t> local_insert(&m_ParsingObjNums, objnum);
if (GetObjectType(objnum) == 1 || GetObjectType(objnum) == 255) {
FX_FILESIZE pos = m_ObjectInfo[objnum].pos;
if (pos <= 0)
@@ -1181,8 +1181,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
// Read object numbers from |pObjStream| into a cache.
if (!pdfium::ContainsKey(m_ObjCache, pObjStream)) {
for (int32_t i = GetStreamNCount(pObjStream); i > 0; --i) {
- FX_DWORD thisnum = syntax.GetDirectNum();
- FX_DWORD thisoff = syntax.GetDirectNum();
+ uint32_t thisnum = syntax.GetDirectNum();
+ uint32_t thisoff = syntax.GetDirectNum();
m_ObjCache[pObjStream][thisnum] = thisoff;
}
}
@@ -1195,7 +1195,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
return syntax.GetObject(pObjList, 0, 0, true);
}
-CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) {
+CPDF_StreamAcc* CPDF_Parser::GetObjectStream(uint32_t objnum) {
auto it = m_ObjectStreamMap.find(objnum);
if (it != m_ObjectStreamMap.end())
return it->second.get();
@@ -1213,7 +1213,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) {
return pStreamAcc;
}
-FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) const {
+FX_FILESIZE CPDF_Parser::GetObjectSize(uint32_t objnum) const {
if (!IsValidObjectNumber(objnum))
return 0;
@@ -1234,9 +1234,9 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) const {
return *it - offset;
}
-void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
+void CPDF_Parser::GetIndirectBinary(uint32_t objnum,
uint8_t*& pBuffer,
- FX_DWORD& size) {
+ uint32_t& size) {
pBuffer = nullptr;
size = 0;
if (!IsValidObjectNumber(objnum))
@@ -1249,15 +1249,15 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
int32_t offset = GetStreamFirst(pObjStream);
const uint8_t* pData = pObjStream->GetData();
- FX_DWORD totalsize = pObjStream->GetSize();
+ uint32_t totalsize = pObjStream->GetSize();
ScopedFileStream file(
FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE));
CPDF_SyntaxParser syntax;
syntax.InitParser(file.get(), 0);
for (int i = GetStreamNCount(pObjStream); i > 0; --i) {
- FX_DWORD thisnum = syntax.GetDirectNum();
- FX_DWORD thisoff = syntax.GetDirectNum();
+ uint32_t thisnum = syntax.GetDirectNum();
+ uint32_t thisoff = syntax.GetDirectNum();
if (thisnum != objnum)
continue;
@@ -1265,7 +1265,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
size = totalsize - (thisoff + offset);
} else {
syntax.GetDirectNum(); // Skip nextnum.
- FX_DWORD nextoff = syntax.GetDirectNum();
+ uint32_t nextoff = syntax.GetDirectNum();
size = nextoff - thisoff;
}
@@ -1293,7 +1293,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
return;
}
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (parser_objnum && parser_objnum != objnum) {
m_pSyntax->RestorePos(SavedPos);
return;
@@ -1343,7 +1343,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
nextoff = m_pSyntax->SavePos();
}
- size = (FX_DWORD)(nextoff - pos);
+ size = (uint32_t)(nextoff - pos);
pBuffer = FX_Alloc(uint8_t, size);
m_pSyntax->RestorePos(pos);
m_pSyntax->ReadBlock(pBuffer, size);
@@ -1353,7 +1353,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum) {
+ uint32_t objnum) {
FX_FILESIZE SavedPos = m_pSyntax->SavePos();
m_pSyntax->RestorePos(pos);
bool bIsNumber;
@@ -1365,7 +1365,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
FX_FILESIZE objOffset = m_pSyntax->SavePos();
objOffset -= word.GetLength();
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (objnum && parser_objnum != objnum) {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1377,7 +1377,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
return nullptr;
}
- FX_DWORD parser_gennum = FXSYS_atoui(word);
+ uint32_t parser_gennum = FXSYS_atoui(word);
if (m_pSyntax->GetKeyword() != "obj") {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1403,7 +1403,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
FX_FILESIZE* pResultPos) {
FX_FILESIZE SavedPos = m_pSyntax->SavePos();
m_pSyntax->RestorePos(pos);
@@ -1415,7 +1415,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
return nullptr;
}
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (objnum && parser_objnum != objnum) {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1427,7 +1427,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
return nullptr;
}
- FX_DWORD gennum = FXSYS_atoui(word);
+ uint32_t gennum = FXSYS_atoui(word);
if (m_pSyntax->GetKeyword() != "obj") {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1452,11 +1452,11 @@ CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() {
return pObj.release()->AsDictionary();
}
-FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
+uint32_t CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
if (!m_pSecurityHandler)
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
- FX_DWORD dwPermission = m_pSecurityHandler->GetPermissions();
+ uint32_t dwPermission = m_pSecurityHandler->GetPermissions();
if (m_pEncryptDict && m_pEncryptDict->GetStringBy("Filter") == "Standard") {
dwPermission &= 0xFFFFFFFC;
dwPermission |= 0xFFFFF0C0;
@@ -1467,7 +1467,7 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
}
FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
- FX_DWORD offset) {
+ uint32_t offset) {
m_pSyntax->InitParser(pFileAccess, offset);
m_pSyntax->RestorePos(m_pSyntax->m_HeaderOffset + 9);
@@ -1477,12 +1477,12 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
if (!bIsNumber)
return FALSE;
- FX_DWORD objnum = FXSYS_atoui(word);
+ uint32_t objnum = FXSYS_atoui(word);
word = m_pSyntax->GetNextWord(&bIsNumber);
if (!bIsNumber)
return FALSE;
- FX_DWORD gennum = FXSYS_atoui(word);
+ uint32_t gennum = FXSYS_atoui(word);
if (m_pSyntax->GetKeyword() != "obj") {
m_pSyntax->RestorePos(SavedPos);
return FALSE;
@@ -1617,7 +1617,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos) {
}
CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
- FX_DWORD dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum;
+ uint32_t dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum;
m_pSyntax->m_MetadataObjnum = 0;
if (m_pTrailer) {
m_pTrailer->Release();
@@ -1626,7 +1626,7 @@ CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
m_pSyntax->RestorePos(m_LastXRefOffset - m_pSyntax->m_HeaderOffset);
uint8_t ch = 0;
- FX_DWORD dwCount = 0;
+ uint32_t dwCount = 0;
m_pSyntax->GetNextChar(ch);
while (PDFCharIsWhitespace(ch)) {
++dwCount;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
index 6aa8fe9b4a..9053d08b36 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
@@ -62,7 +62,7 @@ CPDF_Object* CPDF_Reference::Clone(FX_BOOL bDirect) const {
return new CPDF_Reference(m_pObjList, m_RefObjNum);
}
-void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum) {
+void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum) {
m_pObjList = pDoc;
m_RefObjNum = objnum;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp
index a13fb0f365..e32021e25d 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp
@@ -8,13 +8,13 @@
#include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h"
-CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize)
+CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize)
: m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {}
CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str)
: m_pData(str.GetPtr()), m_dwSize(str.GetLength()), m_dwCurPos(0) {}
-void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) {
+void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) {
pStart = nullptr;
dwSize = 0;
uint8_t ch;
@@ -40,7 +40,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) {
}
}
- FX_DWORD start_pos = m_dwCurPos - 1;
+ uint32_t start_pos = m_dwCurPos - 1;
pStart = m_pData + start_pos;
if (PDFCharIsDelimiter(ch)) {
if (ch == '/') {
@@ -93,7 +93,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) {
CFX_ByteStringC CPDF_SimpleParser::GetWord() {
const uint8_t* pStart;
- FX_DWORD dwSize;
+ uint32_t dwSize;
ParseWord(pStart, dwSize);
if (dwSize == 1 && pStart[0] == '<') {
while (m_dwCurPos < m_dwSize && m_pData[m_dwCurPos] != '>') {
@@ -139,7 +139,7 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() {
bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token,
int nParams) {
nParams++;
- FX_DWORD* pBuf = FX_Alloc(FX_DWORD, nParams);
+ uint32_t* pBuf = FX_Alloc(uint32_t, nParams);
int buf_index = 0;
int buf_count = 0;
m_dwCurPos = 0;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp
index 17ef914c80..46384244e8 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp
@@ -15,8 +15,8 @@
IPDF_CryptoHandler::~IPDF_CryptoHandler() {}
-void IPDF_CryptoHandler::Decrypt(FX_DWORD objnum,
- FX_DWORD gennum,
+void IPDF_CryptoHandler::Decrypt(uint32_t objnum,
+ uint32_t gennum,
CFX_ByteString& str) {
CFX_BinaryBuf dest_buf;
void* context = DecryptStart(objnum, gennum);
@@ -26,12 +26,12 @@ void IPDF_CryptoHandler::Decrypt(FX_DWORD objnum,
}
void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
if (m_Cipher == FXCIPHER_NONE) {
FXSYS_memcpy(dest_buf, src_buf, src_size);
return;
@@ -96,11 +96,11 @@ struct AESCryptContext {
uint8_t m_Context[2048];
FX_BOOL m_bIV;
uint8_t m_Block[16];
- FX_DWORD m_BlockOffset;
+ uint32_t m_BlockOffset;
};
-void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum,
- FX_DWORD gennum,
+void* CPDF_StandardCryptoHandler::CryptStart(uint32_t objnum,
+ uint32_t gennum,
FX_BOOL bEncrypt) {
if (m_Cipher == FXCIPHER_NONE) {
return this;
@@ -151,7 +151,7 @@ void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum,
}
FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf,
FX_BOOL bEncrypt) {
if (!context) {
@@ -172,10 +172,10 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context,
dest_buf.AppendBlock(pContext->m_Block, 16);
pContext->m_bIV = FALSE;
}
- FX_DWORD src_off = 0;
- FX_DWORD src_left = src_size;
+ uint32_t src_off = 0;
+ uint32_t src_left = src_size;
while (1) {
- FX_DWORD copy_size = 16 - pContext->m_BlockOffset;
+ uint32_t copy_size = 16 - pContext->m_BlockOffset;
if (copy_size > src_left) {
copy_size = src_left;
}
@@ -244,11 +244,11 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context,
FX_Free(pContext);
return TRUE;
}
-void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum,
- FX_DWORD gennum) {
+void* CPDF_StandardCryptoHandler::DecryptStart(uint32_t objnum,
+ uint32_t gennum) {
return CryptStart(objnum, gennum, FALSE);
}
-FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size) {
+uint32_t CPDF_StandardCryptoHandler::DecryptGetSize(uint32_t src_size) {
return m_Cipher == FXCIPHER_AES ? src_size - 16 : src_size;
}
@@ -306,7 +306,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher,
}
FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf) {
return CryptStream(context, src_buf, src_size, dest_buf, FALSE);
}
@@ -314,21 +314,21 @@ FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(void* context,
CFX_BinaryBuf& dest_buf) {
return CryptFinish(context, dest_buf, FALSE);
}
-FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum,
- FX_DWORD version,
+uint32_t CPDF_StandardCryptoHandler::EncryptGetSize(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size) {
+ uint32_t src_size) {
if (m_Cipher == FXCIPHER_AES) {
return src_size + 32;
}
return src_size;
}
-FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum,
- FX_DWORD gennum,
+FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(uint32_t objnum,
+ uint32_t gennum,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size);
return TRUE;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h
index c40fa7d0a4..689d44b81b 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h
@@ -17,38 +17,38 @@ class CPDF_StandardCryptoHandler : public IPDF_CryptoHandler {
// IPDF_CryptoHandler
FX_BOOL Init(CPDF_Dictionary* pEncryptDict,
IPDF_SecurityHandler* pSecurityHandler) override;
- FX_DWORD DecryptGetSize(FX_DWORD src_size) override;
- void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) override;
+ uint32_t DecryptGetSize(uint32_t src_size) override;
+ void* DecryptStart(uint32_t objnum, uint32_t gennum) override;
FX_BOOL DecryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf) override;
FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) override;
- FX_DWORD EncryptGetSize(FX_DWORD objnum,
- FX_DWORD version,
+ uint32_t EncryptGetSize(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size) override;
- FX_BOOL EncryptContent(FX_DWORD objnum,
- FX_DWORD version,
+ uint32_t src_size) override;
+ FX_BOOL EncryptContent(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) override;
+ uint32_t& dest_size) override;
FX_BOOL Init(int cipher, const uint8_t* key, int keylen);
protected:
virtual void CryptBlock(FX_BOOL bEncrypt,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size);
- virtual void* CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt);
+ uint32_t& dest_size);
+ virtual void* CryptStart(uint32_t objnum, uint32_t gennum, FX_BOOL bEncrypt);
virtual FX_BOOL CryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf,
FX_BOOL bEncrypt);
virtual FX_BOOL CryptFinish(void* context,
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
index 14e7ed65d3..ac7667c3ea 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
@@ -24,14 +24,14 @@ const uint8_t defpasscode[32] = {
void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
uint8_t* key,
int keylen,
FX_BOOL bIgnoreMeta,
CPDF_Array* pIdArray) {
int revision = pEncrypt->GetIntegerBy("R");
uint8_t passcode[32];
- for (FX_DWORD i = 0; i < 32; i++) {
+ for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size];
}
uint8_t md5[100];
@@ -39,7 +39,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
CRYPT_MD5Update(md5, passcode, 32);
CFX_ByteString okey = pEncrypt->GetStringBy("O");
CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength());
- FX_DWORD perm = pEncrypt->GetIntegerBy("P");
+ uint32_t perm = pEncrypt->GetIntegerBy("P");
CRYPT_MD5Update(md5, (uint8_t*)&perm, 4);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetStringAt(0);
@@ -47,12 +47,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
}
if (!bIgnoreMeta && revision >= 3 &&
!pEncrypt->GetIntegerBy("EncryptMetadata", 1)) {
- FX_DWORD tag = (FX_DWORD)-1;
+ uint32_t tag = (uint32_t)-1;
CRYPT_MD5Update(md5, (uint8_t*)&tag, 4);
}
uint8_t digest[16];
CRYPT_MD5Finish(md5, digest);
- FX_DWORD copy_len = keylen;
+ uint32_t copy_len = keylen;
if (copy_len > sizeof(digest)) {
copy_len = sizeof(digest);
}
@@ -111,7 +111,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len) {
return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey,
key_len);
}
-FX_DWORD CPDF_StandardSecurityHandler::GetPermissions() {
+uint32_t CPDF_StandardSecurityHandler::GetPermissions() {
return m_Permissions;
}
static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
@@ -180,7 +180,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
}
FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
- FX_DWORD type,
+ uint32_t type,
int& cipher,
int& key_len) {
m_pEncryptDict = pEncryptDict;
@@ -213,14 +213,14 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher,
}
#define FX_GET_32WORD(n, b, i) \
{ \
- (n) = (FX_DWORD)( \
+ (n) = (uint32_t)( \
((uint64_t)(b)[(i)] << 24) | ((uint64_t)(b)[(i) + 1] << 16) | \
((uint64_t)(b)[(i) + 2] << 8) | ((uint64_t)(b)[(i) + 3])); \
}
int BigOrder64BitsMod3(uint8_t* data) {
uint64_t ret = 0;
for (int i = 0; i < 4; ++i) {
- FX_DWORD value;
+ uint32_t value;
FX_GET_32WORD(value, data, 4 * i);
ret <<= 32;
ret |= value;
@@ -229,7 +229,7 @@ int BigOrder64BitsMod3(uint8_t* data) {
return (int)ret;
}
void Revision6_Hash(const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
const uint8_t* salt,
const uint8_t* vector,
uint8_t* hash) {
@@ -306,7 +306,7 @@ void Revision6_Hash(const uint8_t* password,
}
FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
uint8_t* key) {
CFX_ByteString okey =
@@ -372,8 +372,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
}
uint8_t perms_buf[16];
FXSYS_memset(perms_buf, 0, sizeof(perms_buf));
- FX_DWORD copy_len = sizeof(perms_buf);
- if (copy_len > (FX_DWORD)perms.GetLength()) {
+ uint32_t copy_len = sizeof(perms_buf);
+ if (copy_len > (uint32_t)perms.GetLength()) {
copy_len = perms.GetLength();
}
FXSYS_memcpy(perms_buf, (const uint8_t*)perms, copy_len);
@@ -394,7 +394,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
}
int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
uint8_t* key,
int32_t key_len) {
@@ -413,7 +413,7 @@ int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password,
}
FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
FX_BOOL bIgnoreEncryptMeta,
uint8_t* key,
int32_t key_len) {
@@ -430,8 +430,8 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len);
} else {
uint8_t test[32], tmpkey[32];
- FX_DWORD copy_len = sizeof(test);
- if (copy_len > (FX_DWORD)ukey.GetLength()) {
+ uint32_t copy_len = sizeof(test);
+ if (copy_len > (uint32_t)ukey.GetLength()) {
copy_len = ukey.GetLength();
}
FXSYS_memset(test, 0, sizeof(test));
@@ -461,11 +461,11 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
}
CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
const uint8_t* owner_pass,
- FX_DWORD pass_size,
+ uint32_t pass_size,
int32_t key_len) {
CFX_ByteString okey = m_pEncryptDict->GetStringBy("O");
uint8_t passcode[32];
- FX_DWORD i;
+ uint32_t i;
for (i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
}
@@ -478,7 +478,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
}
uint8_t enckey[32];
FXSYS_memset(enckey, 0, sizeof(enckey));
- FX_DWORD copy_len = key_len;
+ uint32_t copy_len = key_len;
if (copy_len > sizeof(digest)) {
copy_len = sizeof(digest);
}
@@ -510,7 +510,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
}
FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(
const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
uint8_t* key,
int32_t key_len) {
CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
@@ -528,11 +528,11 @@ FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted() {
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
+ uint32_t owner_size,
FX_BOOL bDefault,
- FX_DWORD type) {
+ uint32_t type) {
int cipher = 0, key_len = 0;
if (!LoadDict(pEncryptDict, type, cipher, key_len)) {
return;
@@ -561,7 +561,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
}
if (bDefault) {
uint8_t passcode[32];
- FX_DWORD i;
+ uint32_t i;
for (i = 0; i < 32; i++) {
passcode[i] =
i < owner_size ? owner_pass[i] : defpasscode[i - owner_size];
@@ -622,24 +622,24 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
- FX_DWORD type) {
+ uint32_t owner_size,
+ uint32_t type) {
OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size,
TRUE, type);
}
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
- FX_DWORD type) {
+ uint32_t user_size,
+ uint32_t type) {
OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type);
}
void CPDF_StandardSecurityHandler::AES256_SetPassword(
CPDF_Dictionary* pEncryptDict,
const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
const uint8_t* key) {
uint8_t sha[128];
@@ -687,7 +687,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(
}
void CPDF_StandardSecurityHandler::AES256_SetPerms(
CPDF_Dictionary* pEncryptDict,
- FX_DWORD permissions,
+ uint32_t permissions,
FX_BOOL bEncryptMetadata,
const uint8_t* key) {
uint8_t buf[16];
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h
index 8c1629c486..dfbf6a34f9 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h
@@ -22,7 +22,7 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler {
// IPDF_SecurityHandler:
FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict) override;
- FX_DWORD GetPermissions() override;
+ uint32_t GetPermissions() override;
FX_BOOL GetCryptInfo(int& cipher,
const uint8_t*& buffer,
int& keylen) override;
@@ -32,22 +32,22 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler {
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
- FX_DWORD type = PDF_ENCRYPT_CONTENT);
+ uint32_t owner_size,
+ uint32_t type = PDF_ENCRYPT_CONTENT);
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
- FX_DWORD type = PDF_ENCRYPT_CONTENT);
+ uint32_t user_size,
+ uint32_t type = PDF_ENCRYPT_CONTENT);
CFX_ByteString GetUserPassword(const uint8_t* owner_pass,
- FX_DWORD pass_size,
+ uint32_t pass_size,
int32_t key_len);
int CheckPassword(const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
FX_BOOL bOwner,
uint8_t* key,
int key_len);
@@ -55,48 +55,48 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler {
private:
FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict);
FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict,
- FX_DWORD type,
+ uint32_t type,
int& cipher,
int& key_len);
FX_BOOL CheckUserPassword(const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
FX_BOOL bIgnoreEncryptMeta,
uint8_t* key,
int32_t key_len);
FX_BOOL CheckOwnerPassword(const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
uint8_t* key,
int32_t key_len);
FX_BOOL AES256_CheckPassword(const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
uint8_t* key);
void AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
const uint8_t* key);
void AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
- FX_DWORD permission,
+ uint32_t permission,
FX_BOOL bEncryptMetadata,
const uint8_t* key);
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
+ uint32_t owner_size,
FX_BOOL bDefault,
- FX_DWORD type);
+ uint32_t type);
FX_BOOL CheckSecurity(int32_t key_len);
int m_Version;
int m_Revision;
CPDF_Parser* m_pParser;
CPDF_Dictionary* m_pEncryptDict;
- FX_DWORD m_Permissions;
+ uint32_t m_Permissions;
int m_Cipher;
uint8_t m_EncryptKey[32];
int m_KeyLen;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
index 72ecb7e9de..108f487602 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
@@ -10,7 +10,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
-CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict)
+CPDF_Stream::CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict)
: m_pDict(pDict),
m_dwSize(size),
m_GenNum(kMemoryBasedGenNum),
@@ -58,7 +58,7 @@ void CPDF_Stream::InitStreamInternal(CPDF_Dictionary* pDict) {
}
void CPDF_Stream::InitStream(uint8_t* pData,
- FX_DWORD size,
+ uint32_t size,
CPDF_Dictionary* pDict) {
InitStreamInternal(pDict);
m_GenNum = kMemoryBasedGenNum;
@@ -74,7 +74,7 @@ void CPDF_Stream::InitStream(uint8_t* pData,
CPDF_Object* CPDF_Stream::Clone(FX_BOOL bDirect) const {
CPDF_StreamAcc acc;
acc.LoadAllData(this, TRUE);
- FX_DWORD streamSize = acc.GetSize();
+ uint32_t streamSize = acc.GetSize();
CPDF_Dictionary* pDict = GetDict();
if (pDict)
pDict = ToDictionary(pDict->Clone(bDirect));
@@ -83,7 +83,7 @@ CPDF_Object* CPDF_Stream::Clone(FX_BOOL bDirect) const {
}
void CPDF_Stream::SetData(const uint8_t* pData,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bCompressed,
FX_BOOL bKeepBuf) {
if (IsMemoryBased())
@@ -110,7 +110,7 @@ void CPDF_Stream::SetData(const uint8_t* pData,
FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset,
uint8_t* buf,
- FX_DWORD size) const {
+ uint32_t size) const {
if (!IsMemoryBased() && m_pFile)
return m_pFile->ReadBlock(buf, offset, size);
@@ -124,7 +124,7 @@ void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile,
CPDF_Dictionary* pDict) {
InitStreamInternal(pDict);
m_pFile = pFile;
- m_dwSize = (FX_DWORD)pFile->GetSize();
+ m_dwSize = (uint32_t)pFile->GetSize();
if (m_pDict)
m_pDict->SetAtInteger("Length", m_dwSize);
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp
index f10e33758c..afac3ebf6f 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp
@@ -18,7 +18,7 @@ CPDF_StreamAcc::CPDF_StreamAcc()
void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
FX_BOOL bRawAccess,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
FX_BOOL bImageAcc) {
if (!pStream)
return;
@@ -31,7 +31,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
return;
}
uint8_t* pSrcData;
- FX_DWORD dwSrcSize = pStream->GetRawSize();
+ uint32_t dwSrcSize = pStream->GetRawSize();
if (dwSrcSize == 0)
return;
@@ -43,7 +43,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
pSrcData = pStream->GetRawData();
}
uint8_t* pDecryptedData = pSrcData;
- FX_DWORD dwDecryptedSize = dwSrcSize;
+ uint32_t dwDecryptedSize = dwSrcSize;
if (!pStream->GetDict()->KeyExist("Filter") || bRawAccess) {
m_pData = pDecryptedData;
m_dwSize = dwDecryptedSize;
@@ -83,7 +83,7 @@ const uint8_t* CPDF_StreamAcc::GetData() const {
return m_pStream->GetRawData();
}
-FX_DWORD CPDF_StreamAcc::GetSize() const {
+uint32_t CPDF_StreamAcc::GetSize() const {
if (m_bNewBuf) {
return m_dwSize;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
index 00e2ee6a13..d14eeb991c 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
@@ -28,8 +28,8 @@ namespace {
struct SearchTagRecord {
const char* m_pTag;
- FX_DWORD m_Len;
- FX_DWORD m_Offset;
+ uint32_t m_Len;
+ uint32_t m_Offset;
};
} // namespace
@@ -60,14 +60,14 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) {
if (m_BufOffset >= pos || (FX_FILESIZE)(m_BufOffset + m_BufSize) <= pos) {
FX_FILESIZE read_pos = pos;
- FX_DWORD read_size = m_BufSize;
+ uint32_t read_size = m_BufSize;
if ((FX_FILESIZE)read_size > m_FileLen)
- read_size = (FX_DWORD)m_FileLen;
+ read_size = (uint32_t)m_FileLen;
if ((FX_FILESIZE)(read_pos + read_size) > m_FileLen) {
if (m_FileLen < (FX_FILESIZE)read_size) {
read_pos = 0;
- read_size = (FX_DWORD)m_FileLen;
+ read_size = (uint32_t)m_FileLen;
} else {
read_pos = m_FileLen - read_size;
}
@@ -95,11 +95,11 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
else
read_pos = pos - m_BufSize + 1;
- FX_DWORD read_size = m_BufSize;
+ uint32_t read_size = m_BufSize;
if ((FX_FILESIZE)(read_pos + read_size) > m_FileLen) {
if (m_FileLen < (FX_FILESIZE)read_size) {
read_pos = 0;
- read_size = (FX_DWORD)m_FileLen;
+ read_size = (uint32_t)m_FileLen;
} else {
read_pos = m_FileLen - read_size;
}
@@ -114,7 +114,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
return TRUE;
}
-FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size) {
+FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, uint32_t size) {
if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size))
return FALSE;
m_Pos += size;
@@ -375,8 +375,8 @@ CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
}
CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
FX_BOOL bDecrypt) {
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
@@ -394,7 +394,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
if (bIsNumber) {
CFX_ByteString nextword2 = GetNextWord(nullptr);
if (nextword2 == "R") {
- FX_DWORD objnum = FXSYS_atoui(word);
+ uint32_t objnum = FXSYS_atoui(word);
return new CPDF_Reference(pObjList, objnum);
}
}
@@ -500,8 +500,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum) {
+ uint32_t objnum,
+ uint32_t gennum) {
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
return nullptr;
@@ -628,8 +628,8 @@ unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) {
}
CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
- FX_DWORD objnum,
- FX_DWORD gennum) {
+ uint32_t objnum,
+ uint32_t gennum) {
CPDF_Object* pLenObj = pDict->GetElement("Length");
FX_FILESIZE len = -1;
CPDF_Reference* pLenObjRef = ToReference(pLenObj);
@@ -647,7 +647,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
const CFX_ByteStringC kEndObjStr("endobj");
IPDF_CryptoHandler* pCryptoHandler =
- objnum == (FX_DWORD)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get();
+ objnum == (uint32_t)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get();
if (!pCryptoHandler) {
FX_BOOL bSearchForKeyword = TRUE;
if (len >= 0) {
@@ -782,7 +782,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess,
- FX_DWORD HeaderOffset) {
+ uint32_t HeaderOffset) {
FX_Free(m_pFileBuf);
m_pFileBuf = FX_Alloc(uint8_t, m_BufSize);
@@ -810,7 +810,7 @@ bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
const CFX_ByteStringC& tag,
FX_BOOL checkKeyword) {
- const FX_DWORD taglen = tag.GetLength();
+ const uint32_t taglen = tag.GetLength();
bool bCheckLeft = !PDFCharIsDelimiter(tag[0]) && !PDFCharIsWhitespace(tag[0]);
bool bCheckRight = !PDFCharIsDelimiter(tag[taglen - 1]) &&
@@ -914,12 +914,12 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags,
}
std::vector<SearchTagRecord> patterns(ntags);
- FX_DWORD start = 0;
- FX_DWORD itag = 0;
- FX_DWORD max_len = 0;
+ uint32_t start = 0;
+ uint32_t itag = 0;
+ uint32_t max_len = 0;
for (int i = 0; i <= tags.GetLength(); ++i) {
if (tags[i] == 0) {
- FX_DWORD len = i - start;
+ uint32_t len = i - start;
max_len = std::max(len, max_len);
patterns[itag].m_pTag = tags.GetCStr() + start;
patterns[itag].m_Len = len;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
index 2e613d5cd9..26b6a8d3df 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
@@ -23,18 +23,18 @@ class CPDF_SyntaxParser {
CPDF_SyntaxParser();
~CPDF_SyntaxParser();
- void InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOffset);
+ void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset);
FX_FILESIZE SavePos() const { return m_Pos; }
void RestorePos(FX_FILESIZE pos) { m_Pos = pos; }
CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
FX_BOOL bDecrypt);
CPDF_Object* GetObjectByStrict(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum);
+ uint32_t objnum,
+ uint32_t gennum);
CFX_ByteString GetKeyword();
void ToNextLine();
@@ -51,7 +51,7 @@ class CPDF_SyntaxParser {
void SetEncrypt(std::unique_ptr<IPDF_CryptoHandler> pCryptoHandler);
- FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size);
+ FX_BOOL ReadBlock(uint8_t* pBuf, uint32_t size);
FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch);
CFX_ByteString GetNextWord(bool* bIsNumber);
@@ -77,20 +77,20 @@ class CPDF_SyntaxParser {
CFX_ByteString ReadHexString();
unsigned int ReadEOLMarkers(FX_FILESIZE pos);
CPDF_Stream* ReadStream(CPDF_Dictionary* pDict,
- FX_DWORD objnum,
- FX_DWORD gennum);
+ uint32_t objnum,
+ uint32_t gennum);
FX_FILESIZE m_Pos;
int m_MetadataObjnum;
IFX_FileRead* m_pFileAccess;
- FX_DWORD m_HeaderOffset;
+ uint32_t m_HeaderOffset;
FX_FILESIZE m_FileLen;
uint8_t* m_pFileBuf;
- FX_DWORD m_BufSize;
+ uint32_t m_BufSize;
FX_FILESIZE m_BufOffset;
std::unique_ptr<IPDF_CryptoHandler> m_pCryptoHandler;
uint8_t m_WordBuffer[257];
- FX_DWORD m_WordSize;
+ uint32_t m_WordSize;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index e6f531da53..219a72507b 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -50,18 +50,18 @@ const uint16_t PDFDocEncoding[256] = {
0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb,
0x00fc, 0x00fd, 0x00fe, 0x00ff};
-FX_DWORD A85Decode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t A85Decode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
dest_size = 0;
dest_buf = nullptr;
if (src_size == 0)
return 0;
// Count legal characters and zeros.
- FX_DWORD zcount = 0;
- FX_DWORD pos = 0;
+ uint32_t zcount = 0;
+ uint32_t pos = 0;
while (pos < src_size) {
uint8_t ch = src_buf[pos];
if (ch == 'z') {
@@ -78,9 +78,9 @@ FX_DWORD A85Decode(const uint8_t* src_buf,
// Count the space needed to contain non-zero characters. The encoding ratio
// of Ascii85 is 4:5.
- FX_DWORD space_for_non_zeroes = (pos - zcount) / 5 * 4 + 4;
+ uint32_t space_for_non_zeroes = (pos - zcount) / 5 * 4 + 4;
if (zcount > (UINT_MAX - space_for_non_zeroes) / 4) {
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
}
dest_buf = FX_Alloc(uint8_t, zcount * 4 + space_for_non_zeroes);
size_t state = 0;
@@ -123,17 +123,17 @@ FX_DWORD A85Decode(const uint8_t* src_buf,
return pos;
}
-FX_DWORD HexDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t HexDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
dest_size = 0;
if (src_size == 0) {
dest_buf = nullptr;
return 0;
}
- FX_DWORD i = 0;
+ uint32_t i = 0;
// Find the end of data.
while (i < src_size && src_buf[i] != '>')
i++;
@@ -165,26 +165,26 @@ FX_DWORD HexDecode(const uint8_t* src_buf,
return i;
}
-FX_DWORD RunLengthDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t RunLengthDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
- FX_DWORD i = 0;
- FX_DWORD old;
+ uint32_t& dest_size) {
+ uint32_t i = 0;
+ uint32_t old;
dest_size = 0;
while (i < src_size) {
if (src_buf[i] < 128) {
old = dest_size;
dest_size += src_buf[i] + 1;
if (dest_size < old) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
i += src_buf[i] + 2;
} else if (src_buf[i] > 128) {
old = dest_size;
dest_size += 257 - src_buf[i];
if (dest_size < old) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
i += 2;
} else {
@@ -192,17 +192,17 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf,
}
}
if (dest_size >= _STREAM_MAX_SIZE_) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
dest_buf = FX_Alloc(uint8_t, dest_size);
i = 0;
int dest_count = 0;
while (i < src_size) {
if (src_buf[i] < 128) {
- FX_DWORD copy_len = src_buf[i] + 1;
- FX_DWORD buf_left = src_size - i - 1;
+ uint32_t copy_len = src_buf[i] + 1;
+ uint32_t buf_left = src_size - i - 1;
if (buf_left < copy_len) {
- FX_DWORD delta = copy_len - buf_left;
+ uint32_t delta = copy_len - buf_left;
copy_len = buf_left;
FXSYS_memset(dest_buf + dest_count + copy_len, '\0', delta);
}
@@ -221,7 +221,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf,
break;
}
}
- FX_DWORD ret = i + 1;
+ uint32_t ret = i + 1;
if (ret > src_size) {
ret = src_size;
}
@@ -230,7 +230,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf,
ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
const CPDF_Dictionary* pParams) {
@@ -283,7 +283,7 @@ static FX_BOOL CheckFlateDecodeParams(int Colors,
ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -305,13 +305,13 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
BitsPerComponent, Columns);
}
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CPDF_Dictionary* pParams,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
int predictor = 0;
FX_BOOL bEarlyChange = TRUE;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
@@ -322,7 +322,7 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
Columns = pParams->GetIntegerBy("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
}
}
return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode(
@@ -331,13 +331,13 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
}
FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
const CPDF_Dictionary* pDict,
uint8_t*& dest_buf,
- FX_DWORD& dest_size,
+ uint32_t& dest_size,
CFX_ByteString& ImageEncoding,
CPDF_Dictionary*& pImageParms,
- FX_DWORD last_estimated_size,
+ uint32_t last_estimated_size,
FX_BOOL bImageAcc) {
CPDF_Object* pDecoder = pDict ? pDict->GetElementValue("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
@@ -352,7 +352,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
if (!pParamsArray)
pParams = nullptr;
- for (FX_DWORD i = 0; i < pDecoders->GetCount(); i++) {
+ for (uint32_t i = 0; i < pDecoders->GetCount(); i++) {
DecoderList.push_back(pDecoders->GetConstStringAt(i));
ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr);
}
@@ -361,7 +361,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
ParamList.Add(pParams ? pParams->GetDict() : nullptr);
}
uint8_t* last_buf = (uint8_t*)src_buf;
- FX_DWORD last_size = src_size;
+ uint32_t last_size = src_size;
int nSize = pdfium::CollectionSize<int>(DecoderList);
for (int i = 0; i < nSize; i++) {
int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
@@ -369,7 +369,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
// Use ToDictionary here because we can push nullptr into the ParamList.
CPDF_Dictionary* pParam = ToDictionary(ParamList[i]);
uint8_t* new_buf = nullptr;
- FX_DWORD new_size = (FX_DWORD)-1;
+ uint32_t new_size = (uint32_t)-1;
int offset = -1;
if (decoder == "FlateDecode" || decoder == "Fl") {
if (bImageAcc && i == nSize - 1) {
@@ -431,12 +431,12 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
return TRUE;
}
-CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) {
+CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
CFX_WideString result;
if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) ||
(src_data[0] == 0xff && src_data[1] == 0xfe))) {
bool bBE = src_data[0] == 0xfe;
- FX_DWORD max_chars = (src_len - 2) / 2;
+ uint32_t max_chars = (src_len - 2) / 2;
if (!max_chars) {
return result;
}
@@ -446,7 +446,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) {
FX_WCHAR* dest_buf = result.GetBuffer(max_chars);
const uint8_t* uni_str = src_data + 2;
int dest_pos = 0;
- for (FX_DWORD i = 0; i < max_chars * 2; i += 2) {
+ for (uint32_t i = 0; i < max_chars * 2; i += 2) {
uint16_t unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1])
: (uni_str[i + 1] << 8 | uni_str[i]);
if (unicode == 0x1b) {
@@ -466,7 +466,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) {
result.ReleaseBuffer(dest_pos);
} else {
FX_WCHAR* dest_buf = result.GetBuffer(src_len);
- for (FX_DWORD i = 0; i < src_len; i++)
+ for (uint32_t i = 0; i < src_len; i++)
dest_buf[i] = PDFDocEncoding[src_data[i]];
result.ReleaseBuffer(src_len);
}
@@ -554,9 +554,9 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) {
}
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size);
@@ -564,13 +564,13 @@ void FlateEncode(const uint8_t* src_buf,
}
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors,
@@ -579,10 +579,10 @@ void FlateEncode(const uint8_t* src_buf,
}
}
-FX_DWORD FlateDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t FlateDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
return pEncoders->GetFlateModule()->FlateOrLZWDecode(
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
index 81f8cae354..352e4ee15c 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
@@ -29,7 +29,7 @@ TEST(fpdf_parser_decode, A85Decode) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
pdfium::DecodeTestData* ptr = &test_data[i];
uint8_t* result = nullptr;
- FX_DWORD result_size;
+ uint32_t result_size;
EXPECT_EQ(ptr->processed_size,
A85Decode(ptr->input, ptr->input_size, result, result_size))
<< "for case " << i;
@@ -64,7 +64,7 @@ TEST(fpdf_parser_decode, HexDecode) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
pdfium::DecodeTestData* ptr = &test_data[i];
uint8_t* result = nullptr;
- FX_DWORD result_size;
+ uint32_t result_size;
EXPECT_EQ(ptr->processed_size,
HexDecode(ptr->input, ptr->input_size, result, result_size))
<< "for case " << i;
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index caffb6861b..5bfbfaebac 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -179,7 +179,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
case CPDF_Object::ARRAY: {
const CPDF_Array* p = pObj->AsArray();
buf << "[";
- for (FX_DWORD i = 0; i < p->GetCount(); i++) {
+ for (uint32_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetElement(i);
if (pElement->GetObjNum()) {
buf << " " << pElement->GetObjNum() << " 0 R";
diff --git a/core/fpdfapi/fpdf_parser/include/cfdf_document.h b/core/fpdfapi/fpdf_parser/include/cfdf_document.h
index f01039cd4e..18b9442fa9 100644
--- a/core/fpdfapi/fpdf_parser/include/cfdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cfdf_document.h
@@ -18,7 +18,7 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
static CFDF_Document* CreateNewDoc();
static CFDF_Document* ParseFile(IFX_FileRead* pFile,
FX_BOOL bOwnFile = FALSE);
- static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size);
+ static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size);
~CFDF_Document();
FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
index 2ee7760a77..3efa03e0d5 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
@@ -24,34 +24,34 @@ class CPDF_Array : public CPDF_Object {
CPDF_Array* AsArray() override;
const CPDF_Array* AsArray() const override;
- FX_DWORD GetCount() const { return m_Objects.GetSize(); }
- CPDF_Object* GetElement(FX_DWORD index) const;
- CPDF_Object* GetElementValue(FX_DWORD index) const;
+ uint32_t GetCount() const { return m_Objects.GetSize(); }
+ CPDF_Object* GetElement(uint32_t index) const;
+ CPDF_Object* GetElementValue(uint32_t index) const;
CFX_Matrix GetMatrix();
CFX_FloatRect GetRect();
- CFX_ByteString GetStringAt(FX_DWORD index) const;
- CFX_ByteStringC GetConstStringAt(FX_DWORD index) const;
- int GetIntegerAt(FX_DWORD index) const;
- FX_FLOAT GetNumberAt(FX_DWORD index) const;
- CPDF_Dictionary* GetDictAt(FX_DWORD index) const;
- CPDF_Stream* GetStreamAt(FX_DWORD index) const;
- CPDF_Array* GetArrayAt(FX_DWORD index) const;
- FX_FLOAT GetFloatAt(FX_DWORD index) const { return GetNumberAt(index); }
+ CFX_ByteString GetStringAt(uint32_t index) const;
+ CFX_ByteStringC GetConstStringAt(uint32_t index) const;
+ int GetIntegerAt(uint32_t index) const;
+ FX_FLOAT GetNumberAt(uint32_t index) const;
+ CPDF_Dictionary* GetDictAt(uint32_t index) const;
+ CPDF_Stream* GetStreamAt(uint32_t index) const;
+ CPDF_Array* GetArrayAt(uint32_t index) const;
+ FX_FLOAT GetFloatAt(uint32_t index) const { return GetNumberAt(index); }
- void SetAt(FX_DWORD index,
+ void SetAt(uint32_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs = nullptr);
- void InsertAt(FX_DWORD index,
+ void InsertAt(uint32_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs = nullptr);
- void RemoveAt(FX_DWORD index, int nCount = 1);
+ void RemoveAt(uint32_t index, int nCount = 1);
void Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr);
void AddNumber(FX_FLOAT f);
void AddInteger(int i);
void AddString(const CFX_ByteString& str);
void AddName(const CFX_ByteString& str);
- void AddReference(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum);
+ void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum);
void AddReference(CPDF_IndirectObjectHolder* pDoc, CPDF_Object* obj) {
AddReference(pDoc, obj->GetObjNum());
}
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
index ebc5cee90a..73eabf9368 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
@@ -65,7 +65,7 @@ class CPDF_Dictionary : public CPDF_Object {
void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f);
void SetAtReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum);
+ uint32_t objnum);
void SetAtReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
CPDF_Object* obj) {
@@ -77,7 +77,7 @@ class CPDF_Dictionary : public CPDF_Object {
void AddReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum);
+ uint32_t objnum);
// Invalidates iterators for the element with the key |key|.
void RemoveAt(const CFX_ByteStringC& key);
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
index 21b9d250fd..bbccf59361 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
@@ -50,8 +50,8 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
int GetPageCount() const;
CPDF_Dictionary* GetPage(int iPage);
- int GetPageIndex(FX_DWORD objnum);
- FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const;
+ int GetPageIndex(uint32_t objnum);
+ uint32_t GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const;
CPDF_DocPageData* GetPageData() { return GetValidatePageData(); }
void ClearPageData();
void RemoveColorSpaceFromPageData(CPDF_Object* pObject);
@@ -60,7 +60,7 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
void ClearRenderData();
void ClearRenderFont();
- FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const;
+ FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm) const;
// |pFontDict| must not be null.
CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict);
@@ -110,8 +110,8 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
int nPagesToGo,
int level);
int _FindPageIndex(CPDF_Dictionary* pNode,
- FX_DWORD& skip_count,
- FX_DWORD objnum,
+ uint32_t& skip_count,
+ uint32_t objnum,
int& index,
int level = 0);
FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting);
@@ -127,9 +127,9 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
CFX_ByteString m_ID1;
CFX_ByteString m_ID2;
FX_BOOL m_bLinearized;
- FX_DWORD m_dwFirstPageNo;
- FX_DWORD m_dwFirstPageObjNum;
- CFX_ArrayTemplate<FX_DWORD> m_PageList;
+ uint32_t m_dwFirstPageNo;
+ uint32_t m_dwFirstPageObjNum;
+ CFX_ArrayTemplate<uint32_t> m_PageList;
CPDF_DocPageData* m_pDocPage;
CPDF_DocRenderData* m_pDocRender;
};
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
index 373159d060..a219181179 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
@@ -16,20 +16,20 @@ class CPDF_Parser;
class CPDF_IndirectObjectHolder {
public:
- using iterator = std::map<FX_DWORD, CPDF_Object*>::iterator;
- using const_iterator = std::map<FX_DWORD, CPDF_Object*>::const_iterator;
+ using iterator = std::map<uint32_t, CPDF_Object*>::iterator;
+ using const_iterator = std::map<uint32_t, CPDF_Object*>::const_iterator;
explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser);
~CPDF_IndirectObjectHolder();
- CPDF_Object* GetIndirectObject(FX_DWORD objnum);
- FX_DWORD AddIndirectObject(CPDF_Object* pObj);
- void ReleaseIndirectObject(FX_DWORD objnum);
+ CPDF_Object* GetIndirectObject(uint32_t objnum);
+ uint32_t AddIndirectObject(CPDF_Object* pObj);
+ void ReleaseIndirectObject(uint32_t objnum);
// Takes ownership of |pObj|.
- FX_BOOL InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj);
+ FX_BOOL InsertIndirectObject(uint32_t objnum, CPDF_Object* pObj);
- FX_DWORD GetLastObjNum() const { return m_LastObjNum; }
+ uint32_t GetLastObjNum() const { return m_LastObjNum; }
iterator begin() { return m_IndirectObjs.begin(); }
const_iterator begin() const { return m_IndirectObjs.begin(); }
iterator end() { return m_IndirectObjs.end(); }
@@ -37,8 +37,8 @@ class CPDF_IndirectObjectHolder {
protected:
CPDF_Parser* m_pParser;
- FX_DWORD m_LastObjNum;
- std::map<FX_DWORD, CPDF_Object*> m_IndirectObjs;
+ uint32_t m_LastObjNum;
+ std::map<uint32_t, CPDF_Object*> m_IndirectObjs;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
index cc461d6218..1ba38a946e 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
@@ -35,8 +35,8 @@ class CPDF_Object {
};
virtual Type GetType() const = 0;
- FX_DWORD GetObjNum() const { return m_ObjNum; }
- FX_DWORD GetGenNum() const { return m_GenNum; }
+ uint32_t GetObjNum() const { return m_ObjNum; }
+ uint32_t GetGenNum() const { return m_GenNum; }
virtual CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const = 0;
virtual CPDF_Object* GetDirect() const;
@@ -85,8 +85,8 @@ class CPDF_Object {
virtual ~CPDF_Object();
void Destroy() { delete this; }
- FX_DWORD m_ObjNum;
- FX_DWORD m_GenNum;
+ uint32_t m_ObjNum;
+ uint32_t m_GenNum;
friend class CPDF_IndirectObjectHolder;
friend class CPDF_Parser;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h
index 933ab1c7fa..45aca8f21a 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h
@@ -38,7 +38,7 @@ class CPDF_Parser {
~CPDF_Parser();
Error StartParse(IFX_FileRead* pFile);
- FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE);
+ uint32_t GetPermissions(FX_BOOL bCheckRevision = FALSE);
void SetPassword(const FX_CHAR* password) { m_Password = password; }
CFX_ByteString GetPassword() { return m_Password; }
@@ -46,46 +46,46 @@ class CPDF_Parser {
FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
CPDF_Document* GetDocument() const { return m_pDocument; }
- FX_DWORD GetRootObjNum();
- FX_DWORD GetInfoObjNum();
+ uint32_t GetRootObjNum();
+ uint32_t GetInfoObjNum();
CPDF_Array* GetIDArray();
CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; }
CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum);
+ uint32_t objnum);
- FX_DWORD GetLastObjNum() const;
- bool IsValidObjectNumber(FX_DWORD objnum) const;
- FX_FILESIZE GetObjectPositionOrZero(FX_DWORD objnum) const;
- uint8_t GetObjectType(FX_DWORD objnum) const;
- uint16_t GetObjectGenNum(FX_DWORD objnum) const;
+ uint32_t GetLastObjNum() const;
+ bool IsValidObjectNumber(uint32_t objnum) const;
+ FX_FILESIZE GetObjectPositionOrZero(uint32_t objnum) const;
+ uint8_t GetObjectType(uint32_t objnum) const;
+ uint16_t GetObjectGenNum(uint32_t objnum) const;
bool IsVersionUpdated() const { return m_bVersionUpdated; }
- bool IsObjectFreeOrNull(FX_DWORD objnum) const;
- FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm);
+ bool IsObjectFreeOrNull(uint32_t objnum) const;
+ FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm);
IPDF_CryptoHandler* GetCryptoHandler();
IFX_FileRead* GetFileAccess() const;
- FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const;
- FX_FILESIZE GetObjectSize(FX_DWORD objnum) const;
+ FX_FILESIZE GetObjectOffset(uint32_t objnum) const;
+ FX_FILESIZE GetObjectSize(uint32_t objnum) const;
- void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size);
+ void GetIndirectBinary(uint32_t objnum, uint8_t*& pBuffer, uint32_t& size);
int GetFileVersion() const { return m_FileVersion; }
FX_BOOL IsXRefStream() const { return m_bXRefStream; }
CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum);
+ uint32_t objnum);
CPDF_Object* ParseIndirectObjectAtByStrict(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
FX_FILESIZE* pResultPos);
Error StartAsyncParse(IFX_FileRead* pFile);
- FX_DWORD GetFirstPageNo() const { return m_dwFirstPageNo; }
+ uint32_t GetFirstPageNo() const { return m_dwFirstPageNo; }
protected:
struct ObjectInfo {
@@ -106,14 +106,14 @@ class CPDF_Parser {
FX_BOOL RebuildCrossRef();
Error SetEncryptHandler();
void ReleaseEncryptHandler();
- FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount);
- FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount);
+ FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
+ FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos);
Error LoadLinearizedMainXRefTable();
- CPDF_StreamAcc* GetObjectStream(FX_DWORD number);
- FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset);
+ CPDF_StreamAcc* GetObjectStream(uint32_t number);
+ FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset);
void SetEncryptDictionary(CPDF_Dictionary* pDict);
- void ShrinkObjectMap(FX_DWORD size);
+ void ShrinkObjectMap(uint32_t size);
CPDF_Document* m_pDocument;
std::unique_ptr<CPDF_SyntaxParser> m_pSyntax;
@@ -127,27 +127,27 @@ class CPDF_Parser {
CFX_ByteString m_bsRecipient;
CFX_ByteString m_FilePath;
CFX_ByteString m_Password;
- std::map<FX_DWORD, ObjectInfo> m_ObjectInfo;
+ std::map<uint32_t, ObjectInfo> m_ObjectInfo;
std::set<FX_FILESIZE> m_SortedOffset;
CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers;
bool m_bVersionUpdated;
CPDF_Object* m_pLinearized;
- FX_DWORD m_dwFirstPageNo;
- FX_DWORD m_dwXrefStartObjNum;
+ uint32_t m_dwFirstPageNo;
+ uint32_t m_dwXrefStartObjNum;
// A map of object numbers to indirect streams. Map owns the streams.
- std::map<FX_DWORD, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap;
+ std::map<uint32_t, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap;
// Mapping of object numbers to offsets. The offsets are relative to the first
// object in the stream.
- using StreamObjectCache = std::map<FX_DWORD, FX_DWORD>;
+ using StreamObjectCache = std::map<uint32_t, uint32_t>;
// Mapping of streams to their object caches. This is valid as long as the
// streams in |m_ObjectStreamMap| are valid.
std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache;
// All indirect object numbers that are being parsed.
- std::set<FX_DWORD> m_ParsingObjNums;
+ std::set<uint32_t> m_ParsingObjNums;
friend class CPDF_DataAvail;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h
index f44f1e437b..b7d826902b 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h
@@ -31,9 +31,9 @@ class CPDF_Reference : public CPDF_Object {
const CPDF_Reference* AsReference() const override;
CPDF_IndirectObjectHolder* GetObjList() const { return m_pObjList; }
- FX_DWORD GetRefObjNum() const { return m_RefObjNum; }
+ uint32_t GetRefObjNum() const { return m_RefObjNum; }
- void SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum);
+ void SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum);
protected:
~CPDF_Reference() override;
@@ -45,7 +45,7 @@ class CPDF_Reference : public CPDF_Object {
}
CPDF_IndirectObjectHolder* m_pObjList;
- FX_DWORD m_RefObjNum;
+ uint32_t m_RefObjNum;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h
index 0bd3b8daac..c9aa12eaa9 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h
@@ -12,7 +12,7 @@
class CPDF_SimpleParser {
public:
- CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize);
+ CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize);
CPDF_SimpleParser(const CFX_ByteStringC& str);
CFX_ByteStringC GetWord();
@@ -22,14 +22,14 @@ class CPDF_SimpleParser {
bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams);
// For testing only.
- FX_DWORD GetCurPos() const { return m_dwCurPos; }
+ uint32_t GetCurPos() const { return m_dwCurPos; }
private:
- void ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize);
+ void ParseWord(const uint8_t*& pStart, uint32_t& dwSize);
const uint8_t* m_pData;
- FX_DWORD m_dwSize;
- FX_DWORD m_dwCurPos;
+ uint32_t m_dwSize;
+ uint32_t m_dwCurPos;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
index 20045d7aa2..0010a1528e 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
@@ -13,7 +13,7 @@
class CPDF_Stream : public CPDF_Object {
public:
- CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict);
+ CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
// CPDF_Object.
Type GetType() const override;
@@ -24,33 +24,33 @@ class CPDF_Stream : public CPDF_Object {
CPDF_Stream* AsStream() override;
const CPDF_Stream* AsStream() const override;
- FX_DWORD GetRawSize() const { return m_dwSize; }
+ uint32_t GetRawSize() const { return m_dwSize; }
uint8_t* GetRawData() const { return m_pDataBuf; }
void SetData(const uint8_t* pData,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bCompressed,
FX_BOOL bKeepBuf);
- void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict);
+ void InitStream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict);
FX_BOOL ReadRawData(FX_FILESIZE start_pos,
uint8_t* pBuf,
- FX_DWORD buf_size) const;
+ uint32_t buf_size) const;
bool IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; }
protected:
- static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1;
+ static const uint32_t kMemoryBasedGenNum = (uint32_t)-1;
~CPDF_Stream() override;
void InitStreamInternal(CPDF_Dictionary* pDict);
CPDF_Dictionary* m_pDict;
- FX_DWORD m_dwSize;
- FX_DWORD m_GenNum;
+ uint32_t m_dwSize;
+ uint32_t m_GenNum;
union {
uint8_t* m_pDataBuf;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h
index 8fad265a75..6176753deb 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h
@@ -19,7 +19,7 @@ class CPDF_StreamAcc {
void LoadAllData(const CPDF_Stream* pStream,
FX_BOOL bRawAccess = FALSE,
- FX_DWORD estimated_size = 0,
+ uint32_t estimated_size = 0,
FX_BOOL bImageAcc = FALSE);
const CPDF_Stream* GetStream() const { return m_pStream; }
@@ -28,14 +28,14 @@ class CPDF_StreamAcc {
}
const uint8_t* GetData() const;
- FX_DWORD GetSize() const;
+ uint32_t GetSize() const;
const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; }
const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; }
uint8_t* DetachData();
protected:
uint8_t* m_pData;
- FX_DWORD m_dwSize;
+ uint32_t m_dwSize;
FX_BOOL m_bNewBuf;
CFX_ByteString m_ImageDecoder;
CPDF_Dictionary* m_pImageParam;
diff --git a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h
index 4a1d66cabb..1f1095b396 100644
--- a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h
+++ b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h
@@ -19,58 +19,58 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig);
CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
CFX_ByteString PDF_EncodeString(const CFX_ByteString& src,
FX_BOOL bHex = FALSE);
-CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size);
+CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1);
CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
-FX_DWORD FlateDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t& dest_size);
+uint32_t FlateDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
-FX_DWORD RunLengthDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t& dest_size);
+uint32_t RunLengthDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
// Public for testing.
-FX_DWORD A85Decode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t A85Decode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
// Public for testing.
-FX_DWORD HexDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t HexDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
// Public for testing.
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CPDF_Dictionary* pParams,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
const CPDF_Dictionary* pDict,
uint8_t*& dest_buf,
- FX_DWORD& dest_size,
+ uint32_t& dest_size,
CFX_ByteString& ImageEncoding,
CPDF_Dictionary*& pImageParms,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
FX_BOOL bImageAcc);
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_
diff --git a/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h
index d92c06d0cd..e34761ae78 100644
--- a/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h
+++ b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h
@@ -46,13 +46,13 @@ class IPDF_DataAvail {
class FileAvail {
public:
virtual ~FileAvail();
- virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) = 0;
+ virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0;
};
class DownloadHints {
public:
virtual ~DownloadHints();
- virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) = 0;
+ virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0;
};
static IPDF_DataAvail* Create(FileAvail* pFileAvail, IFX_FileRead* pFileRead);
@@ -68,7 +68,7 @@ class IPDF_DataAvail {
virtual DocFormStatus IsFormAvail(DownloadHints* pHints) = 0;
virtual DocLinearizationStatus IsLinearizedPDF() = 0;
virtual void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos,
- FX_DWORD* pSize) = 0;
+ uint32_t* pSize) = 0;
protected:
IPDF_DataAvail(FileAvail* pFileAvail, IFX_FileRead* pFileRead);
diff --git a/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h
index 8e83589a16..ea45a6b9cc 100644
--- a/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h
+++ b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h
@@ -19,27 +19,27 @@ class IPDF_CryptoHandler {
virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict,
IPDF_SecurityHandler* pSecurityHandler) = 0;
- virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0;
- virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0;
+ virtual uint32_t DecryptGetSize(uint32_t src_size) = 0;
+ virtual void* DecryptStart(uint32_t objnum, uint32_t gennum) = 0;
virtual FX_BOOL DecryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf) = 0;
virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) = 0;
- virtual FX_DWORD EncryptGetSize(FX_DWORD objnum,
- FX_DWORD version,
+ virtual uint32_t EncryptGetSize(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size) = 0;
+ uint32_t src_size) = 0;
- virtual FX_BOOL EncryptContent(FX_DWORD objnum,
- FX_DWORD version,
+ virtual FX_BOOL EncryptContent(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) = 0;
+ uint32_t& dest_size) = 0;
- void Decrypt(FX_DWORD objnum, FX_DWORD version, CFX_ByteString& str);
+ void Decrypt(uint32_t objnum, uint32_t version, CFX_ByteString& str);
};
#endif // CORE_FPDFAPI_FPDF_PARSER_IPDF_CRYPTO_HANDLER_H_
diff --git a/core/fpdfapi/fpdf_parser/ipdf_security_handler.h b/core/fpdfapi/fpdf_parser/ipdf_security_handler.h
index fd70b1fac6..e7eb822a83 100644
--- a/core/fpdfapi/fpdf_parser/ipdf_security_handler.h
+++ b/core/fpdfapi/fpdf_parser/ipdf_security_handler.h
@@ -24,7 +24,7 @@ class IPDF_SecurityHandler {
virtual FX_BOOL OnInit(CPDF_Parser* pParser,
CPDF_Dictionary* pEncryptDict) = 0;
- virtual FX_DWORD GetPermissions() = 0;
+ virtual uint32_t GetPermissions() = 0;
virtual FX_BOOL GetCryptInfo(int& cipher,
const uint8_t*& buffer,
int& keylen) = 0;