summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_cmaps/cmap_int.h4
-rw-r--r--core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp16
-rw-r--r--core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp4
-rw-r--r--core/fpdfapi/fpdf_edit/editint.h26
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp148
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp14
-rw-r--r--core/fpdfapi/fpdf_edit/include/cpdf_creator.h28
-rw-r--r--core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp70
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.h30
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_font.cpp26
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp8
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.cpp12
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.h10
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type1font.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type1font.h2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.cpp10
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.h8
-rw-r--r--core/fpdfapi/fpdf_font/font_int.h28
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font.cpp31
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp48
-rw-r--r--core/fpdfapi/fpdf_font/include/cpdf_font.h24
-rw-r--r--core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h4
-rw-r--r--core/fpdfapi/fpdf_font/ttgsubtable.cpp12
-rw-r--r--core/fpdfapi/fpdf_font/ttgsubtable.h4
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_allstates.cpp4
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorspace.cpp6
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorstate.cpp8
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorstate.h2
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorstatedata.h4
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_generalstate.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_image.cpp16
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_meshstream.cpp14
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_meshstream.h18
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_textobject.cpp34
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_colors.cpp4
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_func.cpp20
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp28
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp48
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_clippath.h4
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_colorspace.h8
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_image.h12
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_textobject.h8
-rw-r--r--core/fpdfapi/fpdf_page/pageint.h48
-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
-rw-r--r--core/fpdfapi/fpdf_render/cpdf_pagerendercache.h16
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp14
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_cache.cpp32
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp16
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp108
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp20
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_text.cpp46
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h2
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h4
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h6
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h6
-rw-r--r--core/fpdfapi/fpdf_render/render_int.h66
97 files changed, 1149 insertions, 1150 deletions
diff --git a/core/fpdfapi/fpdf_cmaps/cmap_int.h b/core/fpdfapi/fpdf_cmaps/cmap_int.h
index 9b8db2154d..685d6fe4b1 100644
--- a/core/fpdfapi/fpdf_cmaps/cmap_int.h
+++ b/core/fpdfapi/fpdf_cmaps/cmap_int.h
@@ -26,7 +26,7 @@ void FPDFAPI_FindEmbeddedCMap(const char* name,
int charset,
int coding,
const FXCMAP_CMap*& pMap);
-uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode);
-FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid);
+uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode);
+uint32_t FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid);
#endif // CORE_FPDFAPI_FPDF_CMAPS_CMAP_INT_H_
diff --git a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
index 4e0737dbc2..3cd6106e1c 100644
--- a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp
@@ -45,7 +45,7 @@ static int compareWordRange(const void* key, const void* element) {
};
extern "C" {
static int compareDWordRange(const void* p1, const void* p2) {
- FX_DWORD key = *(FX_DWORD*)p1;
+ uint32_t key = *(uint32_t*)p1;
uint16_t hiword = (uint16_t)(key >> 16);
uint16_t* element = (uint16_t*)p2;
if (hiword < element[0]) {
@@ -66,8 +66,8 @@ static int compareDWordRange(const void* p1, const void* p2) {
};
extern "C" {
static int compareDWordSingle(const void* p1, const void* p2) {
- FX_DWORD key = *(FX_DWORD*)p1;
- FX_DWORD value = ((*(uint16_t*)p2) << 16) | ((uint16_t*)p2)[1];
+ uint32_t key = *(uint32_t*)p1;
+ uint32_t value = ((*(uint16_t*)p2) << 16) | ((uint16_t*)p2)[1];
if (key < value) {
return -1;
}
@@ -77,7 +77,7 @@ static int compareDWordSingle(const void* p1, const void* p2) {
return 0;
}
};
-uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode) {
+uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, uint32_t charcode) {
if (charcode >> 16) {
while (1) {
if (pMap->m_DWordMapType == FXCMAP_CMap::Range) {
@@ -127,7 +127,7 @@ uint16_t FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode) {
}
return 0;
}
-FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) {
+uint32_t FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) {
while (1) {
if (pMap->m_WordMapType == FXCMAP_CMap::Single) {
const uint16_t* pCur = pMap->m_pWordMap;
@@ -159,7 +159,7 @@ FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) {
const uint16_t* pEnd = pMap->m_pDWordMap + pMap->m_DWordCount * 4;
while (pCur < pEnd) {
if (cid >= pCur[3] && cid <= pCur[3] + pCur[2] - pCur[1]) {
- return (((FX_DWORD)pCur[0] << 16) | pCur[1]) + cid - pCur[3];
+ return (((uint32_t)pCur[0] << 16) | pCur[1]) + cid - pCur[3];
}
pCur += 4;
}
@@ -168,7 +168,7 @@ FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) {
const uint16_t* pEnd = pMap->m_pDWordMap + pMap->m_DWordCount * 3;
while (pCur < pEnd) {
if (pCur[2] == cid) {
- return ((FX_DWORD)pCur[0] << 16) | pCur[1];
+ return ((uint32_t)pCur[0] << 16) | pCur[1];
}
pCur += 3;
}
@@ -183,7 +183,7 @@ FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, uint16_t cid) {
void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset,
const uint16_t*& pMap,
- FX_DWORD& count) {
+ uint32_t& count) {
CPDF_FontGlobals* pFontGlobals =
CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals();
pMap = pFontGlobals->m_EmbeddedToUnicodes[charset].m_pMap;
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
index 0ab34eab3c..5f53afd210 100644
--- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
@@ -91,7 +91,7 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
buf << "q " << pImageObj->m_Matrix << " cm ";
if (!pImageObj->m_pImage->IsInline()) {
CPDF_Stream* pStream = pImageObj->m_pImage->GetStream();
- FX_DWORD dwSavedObjNum = pStream->GetObjNum();
+ uint32_t dwSavedObjNum = pStream->GetObjNum();
CFX_ByteString name = RealizeResource(pStream, "XObject");
if (dwSavedObjNum == 0) {
if (pImageObj->m_pImage)
@@ -103,7 +103,7 @@ void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
}
void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf,
const uint8_t* data,
- FX_DWORD size,
+ uint32_t size,
CFX_Matrix& matrix) {
if (!data || !size) {
return;
diff --git a/core/fpdfapi/fpdf_edit/editint.h b/core/fpdfapi/fpdf_edit/editint.h
index eaf93d12da..69a64b9aba 100644
--- a/core/fpdfapi/fpdf_edit/editint.h
+++ b/core/fpdfapi/fpdf_edit/editint.h
@@ -22,46 +22,46 @@ class CPDF_ObjectStream {
FX_BOOL Start();
- int32_t CompressIndirectObject(FX_DWORD dwObjNum, const CPDF_Object* pObj);
- int32_t CompressIndirectObject(FX_DWORD dwObjNum,
+ int32_t CompressIndirectObject(uint32_t dwObjNum, const CPDF_Object* pObj);
+ int32_t CompressIndirectObject(uint32_t dwObjNum,
const uint8_t* pBuffer,
- FX_DWORD dwSize);
+ uint32_t dwSize);
FX_FILESIZE End(CPDF_Creator* pCreator);
- CFX_ArrayTemplate<FX_DWORD> m_ObjNumArray;
+ CFX_ArrayTemplate<uint32_t> m_ObjNumArray;
CFX_ByteTextBuf m_Buffer;
- FX_DWORD m_dwObjNum;
+ uint32_t m_dwObjNum;
int32_t m_index;
protected:
- CFX_ArrayTemplate<FX_DWORD> m_OffsetArray;
+ CFX_ArrayTemplate<uint32_t> m_OffsetArray;
};
class CPDF_XRefStream {
public:
struct Index {
- FX_DWORD objnum;
- FX_DWORD count;
+ uint32_t objnum;
+ uint32_t count;
};
CPDF_XRefStream();
FX_BOOL Start();
- int32_t CompressIndirectObject(FX_DWORD dwObjNum,
+ int32_t CompressIndirectObject(uint32_t dwObjNum,
const CPDF_Object* pObj,
CPDF_Creator* pCreator);
- int32_t CompressIndirectObject(FX_DWORD dwObjNum,
+ int32_t CompressIndirectObject(uint32_t dwObjNum,
const uint8_t* pBuffer,
- FX_DWORD dwSize,
+ uint32_t dwSize,
CPDF_Creator* pCreator);
FX_BOOL End(CPDF_Creator* pCreator, FX_BOOL bEOF = FALSE);
- void AddObjectNumberToIndexArray(FX_DWORD objnum);
+ void AddObjectNumberToIndexArray(uint32_t objnum);
FX_BOOL EndXRefStream(CPDF_Creator* pCreator);
std::vector<Index> m_IndexArray;
FX_FILESIZE m_PrevOffset;
- FX_DWORD m_dwTempObjNum;
+ uint32_t m_dwTempObjNum;
protected:
int32_t EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF = TRUE);
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index f774d0119a..7dc90601c4 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -95,7 +95,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
offset += 1;
const CPDF_Array* p = pObj->AsArray();
- for (FX_DWORD i = 0; i < p->GetCount(); i++) {
+ for (uint32_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetElement(i);
if (pElement->GetObjNum()) {
if (pFile->AppendString(" ") < 0) {
@@ -278,7 +278,7 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
}
int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict,
- FX_DWORD dwObjNum,
+ uint32_t dwObjNum,
CFX_FileBufferArchive* pFile) {
if (!pEncryptDict) {
return 0;
@@ -303,9 +303,9 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict,
return offset;
}
-std::vector<uint8_t> PDF_GenerateFileID(FX_DWORD dwSeed1, FX_DWORD dwSeed2) {
- std::vector<uint8_t> buffer(sizeof(FX_DWORD) * 4);
- FX_DWORD* pBuffer = reinterpret_cast<FX_DWORD*>(buffer.data());
+std::vector<uint8_t> PDF_GenerateFileID(uint32_t dwSeed1, uint32_t dwSeed2) {
+ std::vector<uint8_t> buffer(sizeof(uint32_t) * 4);
+ uint32_t* pBuffer = reinterpret_cast<uint32_t*>(buffer.data());
void* pContext = FX_Random_MT_Start(dwSeed1);
for (int i = 0; i < 2; ++i)
*pBuffer++ = FX_Random_MT_Generate(pContext);
@@ -338,7 +338,7 @@ void AppendIndex1(CFX_ByteTextBuf& buffer, FX_FILESIZE offset) {
buffer.AppendByte(0);
}
-void AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t index) {
+void AppendIndex2(CFX_ByteTextBuf& buffer, uint32_t objnum, int32_t index) {
buffer.AppendByte(2);
buffer.AppendByte(FX_GETBYTEOFFSET24(objnum));
buffer.AppendByte(FX_GETBYTEOFFSET16(objnum));
@@ -348,11 +348,11 @@ void AppendIndex2(CFX_ByteTextBuf& buffer, FX_DWORD objnum, int32_t index) {
buffer.AppendByte(FX_GETBYTEOFFSET0(index));
}
-bool IsXRefNeedEnd(CPDF_XRefStream* pXRef, FX_DWORD flag) {
+bool IsXRefNeedEnd(CPDF_XRefStream* pXRef, uint32_t flag) {
if (!(flag & FPDFCREATE_INCREMENTAL))
return false;
- FX_DWORD iCount = 0;
+ uint32_t iCount = 0;
for (const auto& pair : pXRef->m_IndexArray)
iCount += pair.count;
@@ -391,12 +391,12 @@ class CPDF_FlateEncoder {
~CPDF_FlateEncoder();
FX_BOOL Initialize(CPDF_Stream* pStream, FX_BOOL bFlateEncode);
FX_BOOL Initialize(const uint8_t* pBuffer,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bFlateEncode,
FX_BOOL bXRefStream = FALSE);
void CloneDict();
uint8_t* m_pData;
- FX_DWORD m_dwSize;
+ uint32_t m_dwSize;
CPDF_Dictionary* m_pDict;
FX_BOOL m_bCloned;
FX_BOOL m_bNewData;
@@ -450,7 +450,7 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream,
return TRUE;
}
FX_BOOL CPDF_FlateEncoder::Initialize(const uint8_t* pBuffer,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bFlateEncode,
FX_BOOL bXRefStream) {
if (!bFlateEncode) {
@@ -481,9 +481,9 @@ class CPDF_Encryptor {
FX_BOOL Initialize(IPDF_CryptoHandler* pHandler,
int objnum,
uint8_t* src_data,
- FX_DWORD src_size);
+ uint32_t src_size);
uint8_t* m_pData;
- FX_DWORD m_dwSize;
+ uint32_t m_dwSize;
FX_BOOL m_bNewBuf;
};
CPDF_Encryptor::CPDF_Encryptor() {
@@ -494,7 +494,7 @@ CPDF_Encryptor::CPDF_Encryptor() {
FX_BOOL CPDF_Encryptor::Initialize(IPDF_CryptoHandler* pHandler,
int objnum,
uint8_t* src_data,
- FX_DWORD src_size) {
+ uint32_t src_size) {
if (src_size == 0) {
return TRUE;
}
@@ -527,16 +527,16 @@ FX_BOOL CPDF_ObjectStream::Start() {
m_index = 0;
return TRUE;
}
-int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum,
+int32_t CPDF_ObjectStream::CompressIndirectObject(uint32_t dwObjNum,
const CPDF_Object* pObj) {
m_ObjNumArray.Add(dwObjNum);
m_OffsetArray.Add(m_Buffer.GetLength());
m_Buffer << pObj;
return 1;
}
-int32_t CPDF_ObjectStream::CompressIndirectObject(FX_DWORD dwObjNum,
+int32_t CPDF_ObjectStream::CompressIndirectObject(uint32_t dwObjNum,
const uint8_t* pBuffer,
- FX_DWORD dwSize) {
+ uint32_t dwSize) {
m_ObjNumArray.Add(dwObjNum);
m_OffsetArray.Add(m_Buffer.GetLength());
m_Buffer.AppendBlock(pBuffer, dwSize);
@@ -569,14 +569,14 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
return -1;
}
offset += len;
- if ((len = pFile->AppendDWord((FX_DWORD)iCount)) < 0) {
+ if ((len = pFile->AppendDWord((uint32_t)iCount)) < 0) {
return -1;
}
offset += len;
if (pFile->AppendString("/First ") < 0) {
return -1;
}
- if ((len = pFile->AppendDWord((FX_DWORD)tempBuffer.GetLength())) < 0) {
+ if ((len = pFile->AppendDWord((uint32_t)tempBuffer.GetLength())) < 0) {
return -1;
}
if (pFile->AppendString("/Length ") < 0) {
@@ -585,7 +585,7 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
offset += len + 15;
if (!pCreator->m_bCompress && !pHandler) {
if ((len = pFile->AppendDWord(
- (FX_DWORD)(tempBuffer.GetLength() + m_Buffer.GetLength()))) < 0) {
+ (uint32_t)(tempBuffer.GetLength() + m_Buffer.GetLength()))) < 0) {
return -1;
}
offset += len;
@@ -640,7 +640,7 @@ FX_BOOL CPDF_XRefStream::Start() {
m_iSeg = 0;
return TRUE;
}
-int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum,
+int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum,
const CPDF_Object* pObj,
CPDF_Creator* pCreator) {
if (!pCreator) {
@@ -653,9 +653,9 @@ int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum,
}
return EndObjectStream(pCreator);
}
-int32_t CPDF_XRefStream::CompressIndirectObject(FX_DWORD dwObjNum,
+int32_t CPDF_XRefStream::CompressIndirectObject(uint32_t dwObjNum,
const uint8_t* pBuffer,
- FX_DWORD dwSize,
+ uint32_t dwSize,
CPDF_Creator* pCreator) {
if (!pCreator) {
return 0;
@@ -676,7 +676,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) {
return -1;
}
}
- FX_DWORD& dwObjStmNum = m_ObjStream.m_dwObjNum;
+ uint32_t& dwObjStmNum = m_ObjStream.m_dwObjNum;
if (!dwObjStmNum) {
dwObjStmNum = ++pCreator->m_dwLastObjNum;
}
@@ -687,7 +687,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) {
AppendIndex0(m_Buffer, true);
m_dwTempObjNum++;
}
- FX_DWORD end_num = m_IndexArray.back().objnum + m_IndexArray.back().count;
+ uint32_t end_num = m_IndexArray.back().objnum + m_IndexArray.back().count;
int index = 0;
for (; m_dwTempObjNum < end_num; m_dwTempObjNum++) {
FX_FILESIZE* offset = pCreator->m_ObjectOffset.GetPtrAt(m_dwTempObjNum);
@@ -714,7 +714,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) {
}
for (auto it = m_IndexArray.begin() + m_iSeg; it != m_IndexArray.end();
++it) {
- for (FX_DWORD m = it->objnum; m < it->objnum + it->count; ++m) {
+ for (uint32_t m = it->objnum; m < it->objnum + it->count; ++m) {
if (m_ObjStream.m_index >= iSize ||
m != m_ObjStream.m_ObjNumArray.ElementAt(it - m_IndexArray.begin())) {
AppendIndex1(m_Buffer, pCreator->m_ObjectOffset[m]);
@@ -737,7 +737,7 @@ int32_t CPDF_XRefStream::EndObjectStream(CPDF_Creator* pCreator, FX_BOOL bEOF) {
FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
FX_BOOL bEOF) {
FX_FILESIZE offset_tmp = pCreator->m_Offset;
- FX_DWORD objnum = ++pCreator->m_dwLastObjNum;
+ uint32_t objnum = ++pCreator->m_dwLastObjNum;
CFX_FileBufferArchive* pFile = &pCreator->m_File;
FX_BOOL bIncremental = (pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
if (bIncremental) {
@@ -846,7 +846,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
}
offset += len;
if (pCreator->m_pEncryptDict) {
- FX_DWORD dwEncryptObjNum = pCreator->m_pEncryptDict->GetObjNum();
+ uint32_t dwEncryptObjNum = pCreator->m_pEncryptDict->GetObjNum();
if (dwEncryptObjNum == 0) {
dwEncryptObjNum = pCreator->m_dwEnryptObjNum;
}
@@ -880,7 +880,7 @@ FX_BOOL CPDF_XRefStream::End(CPDF_Creator* pCreator, FX_BOOL bEOF) {
FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) {
if (!(pCreator->m_dwFlags & FPDFCREATE_INCREMENTAL)) {
AppendIndex0(m_Buffer, true);
- for (FX_DWORD i = 1; i < pCreator->m_dwLastObjNum + 1; i++) {
+ for (uint32_t i = 1; i < pCreator->m_dwLastObjNum + 1; i++) {
FX_FILESIZE* offset = pCreator->m_ObjectOffset.GetPtrAt(i);
if (offset) {
AppendIndex1(m_Buffer, *offset);
@@ -890,18 +890,18 @@ FX_BOOL CPDF_XRefStream::EndXRefStream(CPDF_Creator* pCreator) {
}
} else {
for (const auto& pair : m_IndexArray) {
- for (FX_DWORD j = pair.objnum; j < pair.objnum + pair.count; ++j)
+ for (uint32_t j = pair.objnum; j < pair.objnum + pair.count; ++j)
AppendIndex1(m_Buffer, pCreator->m_ObjectOffset[j]);
}
}
return GenerateXRefStream(pCreator, FALSE);
}
-void CPDF_XRefStream::AddObjectNumberToIndexArray(FX_DWORD objnum) {
+void CPDF_XRefStream::AddObjectNumberToIndexArray(uint32_t objnum) {
if (m_IndexArray.empty()) {
m_IndexArray.push_back({objnum, 1});
return;
}
- FX_DWORD next_objnum = m_IndexArray.back().objnum + m_IndexArray.back().count;
+ uint32_t next_objnum = m_IndexArray.back().objnum + m_IndexArray.back().count;
if (objnum == next_objnum)
m_IndexArray.back().count += 1;
else
@@ -949,7 +949,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) {
if (!m_pXRefStream)
return 1;
- FX_DWORD objnum = pObj->GetObjNum();
+ uint32_t objnum = pObj->GetObjNum();
if (m_pParser && m_pParser->GetObjectGenNum(objnum) > 0)
return 1;
@@ -983,9 +983,9 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) {
return -1;
return 0;
}
-int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum,
+int32_t CPDF_Creator::WriteIndirectObjectToStream(uint32_t objnum,
const uint8_t* pBuffer,
- FX_DWORD dwSize) {
+ uint32_t dwSize) {
if (!m_pXRefStream) {
return 1;
}
@@ -1006,7 +1006,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(FX_DWORD objnum,
}
return 0;
}
-int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) {
+int32_t CPDF_Creator::AppendObjectNumberToXRef(uint32_t objnum) {
if (!m_pXRefStream) {
return 1;
}
@@ -1023,7 +1023,7 @@ int32_t CPDF_Creator::AppendObjectNumberToXRef(FX_DWORD objnum) {
return 0;
}
int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream,
- FX_DWORD objnum,
+ uint32_t objnum,
IPDF_CryptoHandler* pCrypto) {
CPDF_FlateEncoder encoder;
encoder.Initialize(const_cast<CPDF_Stream*>(pStream->AsStream()),
@@ -1033,7 +1033,7 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream,
encoder.m_dwSize)) {
return -1;
}
- if ((FX_DWORD)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) {
+ if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") != encryptor.m_dwSize) {
encoder.CloneDict();
encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize);
}
@@ -1055,7 +1055,7 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream,
m_Offset += len;
return 1;
}
-int32_t CPDF_Creator::WriteIndirectObj(FX_DWORD objnum,
+int32_t CPDF_Creator::WriteIndirectObj(uint32_t objnum,
const CPDF_Object* pObj) {
int32_t len = m_File.AppendDWord(objnum);
if (len < 0)
@@ -1091,7 +1091,7 @@ int32_t CPDF_Creator::WriteIndirectObj(const CPDF_Object* pObj) {
}
return WriteIndirectObj(pObj->GetObjNum(), pObj);
}
-int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
+int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
const CPDF_Object* pObj,
FX_BOOL bEncrypt) {
int32_t len = 0;
@@ -1149,7 +1149,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
CPDF_Encryptor encryptor;
IPDF_CryptoHandler* pHandler = m_pCryptoHandler;
encryptor.Initialize(pHandler, objnum, encoder.m_pData, encoder.m_dwSize);
- if ((FX_DWORD)encoder.m_pDict->GetIntegerBy("Length") !=
+ if ((uint32_t)encoder.m_pDict->GetIntegerBy("Length") !=
encryptor.m_dwSize) {
encoder.CloneDict();
encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize);
@@ -1198,7 +1198,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
}
m_Offset += 1;
const CPDF_Array* p = pObj->AsArray();
- for (FX_DWORD i = 0; i < p->GetCount(); i++) {
+ for (uint32_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetElement(i);
if (pElement->GetObjNum()) {
if (m_File.AppendString(" ") < 0) {
@@ -1273,7 +1273,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
}
return 1;
}
-int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
+int32_t CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) {
if (m_pParser->IsObjectFreeOrNull(objnum))
return 0;
@@ -1297,7 +1297,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
}
} else {
uint8_t* pBuffer;
- FX_DWORD size;
+ uint32_t size;
m_pParser->GetIndirectBinary(objnum, pBuffer, size);
if (!pBuffer) {
return 0;
@@ -1340,11 +1340,11 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
return 1;
}
int32_t CPDF_Creator::WriteOldObjs(IFX_Pause* pPause) {
- FX_DWORD nLastObjNum = m_pParser->GetLastObjNum();
+ uint32_t nLastObjNum = m_pParser->GetLastObjNum();
if (!m_pParser->IsValidObjectNumber(nLastObjNum))
return 0;
- FX_DWORD objnum = (FX_DWORD)(uintptr_t)m_Pos;
+ uint32_t objnum = (uint32_t)(uintptr_t)m_Pos;
for (; objnum <= nLastObjNum; ++objnum) {
int32_t iRet = WriteOldIndirectObject(objnum);
if (iRet < 0)
@@ -1364,7 +1364,7 @@ int32_t CPDF_Creator::WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause) {
int32_t iCount = m_NewObjNumArray.GetSize();
int32_t index = (int32_t)(uintptr_t)m_Pos;
while (index < iCount) {
- FX_DWORD objnum = m_NewObjNumArray.ElementAt(index);
+ uint32_t objnum = m_NewObjNumArray.ElementAt(index);
auto it = m_pDocument->m_IndirectObjs.find(objnum);
if (it == m_pDocument->m_IndirectObjs.end()) {
++index;
@@ -1386,9 +1386,9 @@ void CPDF_Creator::InitOldObjNumOffsets() {
if (!m_pParser) {
return;
}
- FX_DWORD j = 0;
- FX_DWORD dwStart = 0;
- FX_DWORD dwEnd = m_pParser->GetLastObjNum();
+ uint32_t j = 0;
+ uint32_t dwStart = 0;
+ uint32_t dwEnd = m_pParser->GetLastObjNum();
while (dwStart <= dwEnd) {
while (dwStart <= dwEnd && m_pParser->IsObjectFreeOrNull(dwStart))
dwStart++;
@@ -1408,7 +1408,7 @@ void CPDF_Creator::InitNewObjNumOffsets() {
FX_BOOL bIncremental = (m_dwFlags & FPDFCREATE_INCREMENTAL) != 0;
FX_BOOL bNoOriginal = (m_dwFlags & FPDFCREATE_NO_ORIGINAL) != 0;
for (const auto& pair : m_pDocument->m_IndirectObjs) {
- const FX_DWORD objnum = pair.first;
+ const uint32_t objnum = pair.first;
const CPDF_Object* pObj = pair.second;
if (pObj->GetObjNum() == -1)
continue;
@@ -1427,7 +1427,7 @@ void CPDF_Creator::InitNewObjNumOffsets() {
return;
}
int32_t i = 0;
- FX_DWORD dwStartObjNum = 0;
+ uint32_t dwStartObjNum = 0;
FX_BOOL bCrossRefValid = m_pParser && m_pParser->GetLastXRefOffset() > 0;
while (i < iCount) {
dwStartObjNum = m_NewObjNumArray.ElementAt(i);
@@ -1440,11 +1440,11 @@ void CPDF_Creator::InitNewObjNumOffsets() {
if (i >= iCount) {
return;
}
- FX_DWORD dwLastObjNum = dwStartObjNum;
+ uint32_t dwLastObjNum = dwStartObjNum;
i++;
FX_BOOL bNewStart = FALSE;
for (; i < iCount; i++) {
- FX_DWORD dwCurObjNum = m_NewObjNumArray.ElementAt(i);
+ uint32_t dwCurObjNum = m_NewObjNumArray.ElementAt(i);
bool bExist = m_pParser && m_pParser->IsValidObjectNumber(dwCurObjNum) &&
m_ObjectOffset.GetPtrAt(dwCurObjNum);
if (bExist || dwCurObjNum - dwLastObjNum > 1) {
@@ -1460,12 +1460,12 @@ void CPDF_Creator::InitNewObjNumOffsets() {
}
m_ObjectOffset.Add(dwStartObjNum, dwLastObjNum - dwStartObjNum + 1);
}
-void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) {
+void CPDF_Creator::AppendNewObjNum(uint32_t objbum) {
int32_t iStart = 0, iFind = 0;
int32_t iEnd = m_NewObjNumArray.GetUpperBound();
while (iStart <= iEnd) {
int32_t iMid = (iStart + iEnd) / 2;
- FX_DWORD dwMid = m_NewObjNumArray.ElementAt(iMid);
+ uint32_t dwMid = m_NewObjNumArray.ElementAt(iMid);
if (objbum < dwMid) {
iEnd = iMid - 1;
} else {
@@ -1473,7 +1473,7 @@ void CPDF_Creator::AppendNewObjNum(FX_DWORD objbum) {
iFind = iMid + 1;
break;
}
- FX_DWORD dwNext = m_NewObjNumArray.ElementAt(iMid + 1);
+ uint32_t dwNext = m_NewObjNumArray.ElementAt(iMid + 1);
if (objbum < dwNext) {
iFind = iMid + 1;
break;
@@ -1538,9 +1538,9 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 && m_Pos) {
IFX_FileRead* pSrcFile = m_pParser->GetFileAccess();
uint8_t buffer[4096];
- FX_DWORD src_size = (FX_DWORD)(uintptr_t)m_Pos;
+ uint32_t src_size = (uint32_t)(uintptr_t)m_Pos;
while (src_size) {
- FX_DWORD block_size = src_size > 4096 ? 4096 : src_size;
+ uint32_t block_size = src_size > 4096 ? 4096 : src_size;
if (!pSrcFile->ReadBlock(buffer, m_Offset - src_size, block_size)) {
return -1;
}
@@ -1557,9 +1557,9 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
if ((m_dwFlags & FPDFCREATE_NO_ORIGINAL) == 0 &&
m_pParser->GetLastXRefOffset() == 0) {
InitOldObjNumOffsets();
- FX_DWORD dwEnd = m_pParser->GetLastObjNum();
+ uint32_t dwEnd = m_pParser->GetLastObjNum();
bool bObjStm = (m_dwFlags & FPDFCREATE_OBJECTSTREAM) != 0;
- for (FX_DWORD objnum = 0; objnum <= dwEnd; objnum++) {
+ for (uint32_t objnum = 0; objnum <= dwEnd; objnum++) {
if (m_pParser->IsObjectFreeOrNull(objnum))
continue;
@@ -1627,7 +1627,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2(IFX_Pause* pPause) {
}
int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
FXSYS_assert(m_iStage >= 80 || m_iStage < 90);
- FX_DWORD dwLastObjNum = m_dwLastObjNum;
+ uint32_t dwLastObjNum = m_dwLastObjNum;
if (m_iStage == 80) {
m_XrefStart = m_Offset;
if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) {
@@ -1660,7 +1660,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
}
if (m_iStage == 81) {
CFX_ByteString str;
- FX_DWORD i = (FX_DWORD)(uintptr_t)m_Pos, j;
+ uint32_t i = (uint32_t)(uintptr_t)m_Pos, j;
while (i <= dwLastObjNum) {
while (i <= dwLastObjNum && !m_ObjectOffset.GetPtrAt(i)) {
i++;
@@ -1702,12 +1702,12 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
int32_t i = (int32_t)(uintptr_t)m_Pos;
while (i < iCount) {
int32_t j = i;
- FX_DWORD objnum = m_NewObjNumArray.ElementAt(i);
+ uint32_t objnum = m_NewObjNumArray.ElementAt(i);
while (j < iCount) {
if (++j == iCount) {
break;
}
- FX_DWORD dwCurrent = m_NewObjNumArray.ElementAt(j);
+ uint32_t dwCurrent = m_NewObjNumArray.ElementAt(j);
if (dwCurrent - objnum > 1) {
break;
}
@@ -1817,7 +1817,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
if (m_File.AppendString("/Encrypt") < 0) {
return -1;
}
- FX_DWORD dwObjNum = m_pEncryptDict->GetObjNum();
+ uint32_t dwObjNum = m_pEncryptDict->GetObjNum();
if (dwObjNum == 0) {
dwObjNum = m_pDocument->GetLastObjNum() + 1;
}
@@ -1870,7 +1870,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
}
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser &&
m_pParser->GetLastXRefOffset() == 0) {
- FX_DWORD i = 0;
+ uint32_t i = 0;
for (i = 0; i < m_dwLastObjNum; i++) {
if (!m_ObjectOffset.GetPtrAt(i)) {
continue;
@@ -1902,7 +1902,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
int count = m_NewObjNumArray.GetSize();
int32_t i = 0;
for (i = 0; i < count; i++) {
- FX_DWORD objnum = m_NewObjNumArray.ElementAt(i);
+ uint32_t objnum = m_NewObjNumArray.ElementAt(i);
if (m_File.AppendDWord(objnum) < 0) {
return -1;
}
@@ -1920,7 +1920,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
return -1;
}
for (i = 0; i < count; i++) {
- FX_DWORD objnum = m_NewObjNumArray.ElementAt(i);
+ uint32_t objnum = m_NewObjNumArray.ElementAt(i);
FX_FILESIZE offset = m_ObjectOffset[objnum];
OutputIndex(&m_File, offset);
}
@@ -1956,12 +1956,12 @@ void CPDF_Creator::Clear() {
}
}
-bool CPDF_Creator::Create(IFX_StreamWrite* pFile, FX_DWORD flags) {
+bool CPDF_Creator::Create(IFX_StreamWrite* pFile, uint32_t flags) {
m_File.AttachFile(pFile);
return Create(flags);
}
-bool CPDF_Creator::Create(FX_DWORD flags) {
+bool CPDF_Creator::Create(uint32_t flags) {
m_dwFlags = flags;
m_iStage = 0;
m_Offset = 0;
@@ -1984,7 +1984,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
m_pIDArray->Add(pID1->Clone());
} else {
std::vector<uint8_t> buffer =
- PDF_GenerateFileID((FX_DWORD)(uintptr_t) this, m_dwLastObjNum);
+ PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum);
CFX_ByteStringC bsBuffer(buffer.data(), buffer.size());
m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument);
}
@@ -1999,7 +1999,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
return;
}
std::vector<uint8_t> buffer =
- PDF_GenerateFileID((FX_DWORD)(uintptr_t) this, m_dwLastObjNum);
+ PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum);
CFX_ByteStringC bsBuffer(buffer.data(), buffer.size());
m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE), m_pDocument);
return;
@@ -2009,7 +2009,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
if (m_pEncryptDict->GetStringBy("Filter") == "Standard") {
CPDF_StandardSecurityHandler handler;
CFX_ByteString user_pass = m_pParser->GetPassword();
- FX_DWORD flag = PDF_ENCRYPT_CONTENT;
+ uint32_t flag = PDF_ENCRYPT_CONTENT;
handler.OnCreate(m_pEncryptDict, m_pIDArray, (const uint8_t*)user_pass,
user_pass.GetLength(), flag);
if (m_bNewCrypto) {
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 8e1072aa00..0f75cb04a8 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -446,7 +446,7 @@ uint32_t FX_GetLangHashCode(const FX_CHAR* pStr) {
return uHashCode;
}
struct FX_LANG2CS {
- FX_DWORD uLang;
+ uint32_t uLang;
int uCharset;
} * FX_LPLANG2CS;
static const FX_LANG2CS gs_FXLang2CharsetTable[] = {
@@ -501,11 +501,11 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString& dest) {
free(pBuffer);
}
FX_BOOL IsHasCharSet(CFArrayRef languages,
- const CFX_ArrayTemplate<FX_DWORD>& charSets) {
+ const CFX_ArrayTemplate<uint32_t>& charSets) {
int iCount = charSets.GetSize();
for (int i = 0; i < CFArrayGetCount(languages); ++i) {
CFStringRef language = (CFStringRef)CFArrayGetValueAtIndex(languages, i);
- FX_DWORD CharSet = FX_GetCharsetFromLang(
+ uint32_t CharSet = FX_GetCharsetFromLang(
CFStringGetCStringPtr(language, kCFStringEncodingMacRoman), -1);
for (int j = 0; j < iCount; ++j) {
if (CharSet == charSets[j]) {
@@ -572,7 +572,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont,
CFRelease(descriptor);
return NULL;
}
- CFX_ArrayTemplate<FX_DWORD> charSets;
+ CFX_ArrayTemplate<uint32_t> charSets;
charSets.Add(FXFONT_CHINESEBIG5_CHARSET);
charSets.Add(FXFONT_GB2312_CHARSET);
charSets.Add(FXFONT_HANGEUL_CHARSET);
@@ -1008,7 +1008,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
} else {
static const FX_CHAR stem_chars[] = {'i', 'I', '!', '1'};
const size_t count = sizeof(stem_chars) / sizeof(stem_chars[0]);
- FX_DWORD glyph = pEncoding->GlyphFromCharCode(stem_chars[0]);
+ uint32_t glyph = pEncoding->GlyphFromCharCode(stem_chars[0]);
nStemV = pFont->GetGlyphWidth(glyph);
for (size_t i = 1; i < count; i++) {
glyph = pEncoding->GlyphFromCharCode(stem_chars[i]);
@@ -1076,7 +1076,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc,
static int InsertNewPage(CPDF_Document* pDoc,
int iPage,
CPDF_Dictionary* pPageDict,
- CFX_ArrayTemplate<FX_DWORD>& pageList) {
+ CFX_ArrayTemplate<uint32_t>& pageList) {
CPDF_Dictionary* pRoot = pDoc->GetRoot();
if (!pRoot) {
return -1;
@@ -1111,7 +1111,7 @@ static int InsertNewPage(CPDF_Document* pDoc,
CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) {
CPDF_Dictionary* pDict = new CPDF_Dictionary;
pDict->SetAtName("Type", "Page");
- FX_DWORD dwObjNum = AddIndirectObject(pDict);
+ uint32_t dwObjNum = AddIndirectObject(pDict);
if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) {
ReleaseIndirectObject(dwObjNum);
return NULL;
diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h
index ad776a2866..d6a1c1079a 100644
--- a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h
+++ b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h
@@ -30,7 +30,7 @@ class CPDF_Creator {
~CPDF_Creator();
void RemoveSecurity();
- bool Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0);
+ bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0);
int32_t Continue(IFX_Pause* pPause = NULL);
FX_BOOL SetFileVersion(int32_t fileVersion = 17);
@@ -38,7 +38,7 @@ class CPDF_Creator {
friend class CPDF_ObjectStream;
friend class CPDF_XRefStream;
- bool Create(FX_DWORD flags);
+ bool Create(uint32_t flags);
void ResetStandardSecurity();
void Clear();
@@ -46,29 +46,29 @@ class CPDF_Creator {
void InitNewObjNumOffsets();
void InitID(FX_BOOL bDefault = TRUE);
- void AppendNewObjNum(FX_DWORD objbum);
- int32_t AppendObjectNumberToXRef(FX_DWORD objnum);
+ void AppendNewObjNum(uint32_t objbum);
+ int32_t AppendObjectNumberToXRef(uint32_t objnum);
int32_t WriteDoc_Stage1(IFX_Pause* pPause);
int32_t WriteDoc_Stage2(IFX_Pause* pPause);
int32_t WriteDoc_Stage3(IFX_Pause* pPause);
int32_t WriteDoc_Stage4(IFX_Pause* pPause);
- int32_t WriteOldIndirectObject(FX_DWORD objnum);
+ int32_t WriteOldIndirectObject(uint32_t objnum);
int32_t WriteOldObjs(IFX_Pause* pPause);
int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause);
int32_t WriteIndirectObj(const CPDF_Object* pObj);
- int32_t WriteDirectObj(FX_DWORD objnum,
+ int32_t WriteDirectObj(uint32_t objnum,
const CPDF_Object* pObj,
FX_BOOL bEncrypt = TRUE);
int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj);
- int32_t WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj);
- int32_t WriteIndirectObjectToStream(FX_DWORD objnum,
+ int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj);
+ int32_t WriteIndirectObjectToStream(uint32_t objnum,
const uint8_t* pBuffer,
- FX_DWORD dwSize);
+ uint32_t dwSize);
int32_t WriteStream(const CPDF_Object* pStream,
- FX_DWORD objnum,
+ uint32_t objnum,
IPDF_CryptoHandler* pCrypto);
CPDF_Document* m_pDocument;
@@ -76,7 +76,7 @@ class CPDF_Creator {
FX_BOOL m_bCompress;
FX_BOOL m_bSecurityChanged;
CPDF_Dictionary* m_pEncryptDict;
- FX_DWORD m_dwEnryptObjNum;
+ uint32_t m_dwEnryptObjNum;
FX_BOOL m_bEncryptCloned;
FX_BOOL m_bStandardSecurity;
IPDF_CryptoHandler* m_pCryptoHandler;
@@ -85,15 +85,15 @@ class CPDF_Creator {
CPDF_Object* m_pMetadata;
CPDF_XRefStream* m_pXRefStream;
int32_t m_ObjectStreamSize;
- FX_DWORD m_dwLastObjNum;
+ uint32_t m_dwLastObjNum;
CFX_FileBufferArchive m_File;
FX_FILESIZE m_Offset;
int32_t m_iStage;
- FX_DWORD m_dwFlags;
+ uint32_t m_dwFlags;
FX_POSITION m_Pos;
FX_FILESIZE m_XrefStart;
CFX_FileSizeListArray m_ObjectOffset;
- CFX_ArrayTemplate<FX_DWORD> m_NewObjNumArray;
+ CFX_ArrayTemplate<uint32_t> m_NewObjNumArray;
CPDF_Array* m_pIDArray;
int32_t m_FileVersion;
};
diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h b/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h
index 53446c34e3..564a9ff54c 100644
--- a/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h
+++ b/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h
@@ -29,7 +29,7 @@ class CPDF_PageContentGenerator {
void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj);
void ProcessForm(CFX_ByteTextBuf& buf,
const uint8_t* data,
- FX_DWORD size,
+ uint32_t size,
CFX_Matrix& matrix);
CFX_ByteString RealizeResource(CPDF_Object* pResourceObj,
const FX_CHAR* szType);
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index 956046c3be..9dd045ede9 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -124,7 +124,7 @@ bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) {
FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
CIDSet charset,
- FX_DWORD charcode) {
+ uint32_t charcode) {
if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
return 0;
@@ -143,7 +143,7 @@ FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
return 0;
}
-FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap,
+uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap,
CIDSet charset,
FX_WCHAR unicode) {
if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
@@ -158,7 +158,7 @@ FX_DWORD EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap,
int nCodes = pFontGlobals->m_EmbeddedToUnicodes[charset].m_Count;
for (int i = 0; i < nCodes; ++i) {
if (pCodes[i] == unicode) {
- FX_DWORD CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i);
+ uint32_t CharCode = FPDFAPI_CharCodeFromCID(pEmbedMap, i);
if (CharCode != 0) {
return CharCode;
}
@@ -234,7 +234,7 @@ CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() {
return this;
}
-uint16_t CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const {
+uint16_t CPDF_CIDFont::CIDFromCharCode(uint32_t charcode) const {
if (!m_pCMap) {
return (uint16_t)charcode;
}
@@ -245,7 +245,7 @@ FX_BOOL CPDF_CIDFont::IsVertWriting() const {
return m_pCMap ? m_pCMap->IsVertWriting() : FALSE;
}
-CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(FX_DWORD charcode) const {
+CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
if (!str.IsEmpty())
return str;
@@ -255,7 +255,7 @@ CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(FX_DWORD charcode) const {
return ret;
}
-FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(FX_DWORD charcode) const {
+FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
switch (m_pCMap->m_Coding) {
case CIDCODING_UCS2:
case CIDCODING_UTF16:
@@ -293,8 +293,8 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(FX_DWORD charcode) const {
return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode));
}
-FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
- FX_DWORD charcode = CPDF_Font::CharCodeFromUnicode(unicode);
+uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
+ uint32_t charcode = CPDF_Font::CharCodeFromUnicode(unicode);
if (charcode)
return charcode;
switch (m_pCMap->m_Coding) {
@@ -307,7 +307,7 @@ FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded()) {
return 0;
}
- FX_DWORD CID = 0;
+ uint32_t CID = 0;
while (CID < 65536) {
FX_WCHAR this_unicode =
m_pCID2UnicodeMap->UnicodeFromCID((uint16_t)CID);
@@ -321,7 +321,7 @@ FX_DWORD CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
}
if (unicode < 0x80) {
- return static_cast<FX_DWORD>(unicode);
+ return static_cast<uint32_t>(unicode);
}
if (m_pCMap->m_Coding == CIDCODING_CID) {
return 0;
@@ -466,7 +466,7 @@ FX_BOOL CPDF_CIDFont::Load() {
return TRUE;
}
-FX_RECT CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, int level) {
+FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode, int level) {
if (charcode < 256 && m_CharBBox[charcode].right != FX_SMALL_RECT::kInvalid)
return FX_RECT(m_CharBBox[charcode]);
@@ -538,13 +538,13 @@ FX_RECT CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, int level) {
return rect;
}
-int CPDF_CIDFont::GetCharWidthF(FX_DWORD charcode, int level) {
+int CPDF_CIDFont::GetCharWidthF(uint32_t charcode, int level) {
if (m_pAnsiWidths && charcode < 0x80) {
return m_pAnsiWidths[charcode];
}
uint16_t cid = CIDFromCharCode(charcode);
int size = m_WidthList.GetSize();
- FX_DWORD* list = m_WidthList.GetData();
+ uint32_t* list = m_WidthList.GetData();
for (int i = 0; i < size; i += 3) {
if (cid >= list[i] && cid <= list[i + 1]) {
return (int)list[i + 2];
@@ -553,31 +553,31 @@ int CPDF_CIDFont::GetCharWidthF(FX_DWORD charcode, int level) {
return m_DefaultWidth;
}
short CPDF_CIDFont::GetVertWidth(uint16_t CID) const {
- FX_DWORD vertsize = m_VertMetrics.GetSize() / 5;
+ uint32_t vertsize = m_VertMetrics.GetSize() / 5;
if (vertsize == 0) {
return m_DefaultW1;
}
- const FX_DWORD* pTable = m_VertMetrics.GetData();
- for (FX_DWORD i = 0; i < vertsize; i++)
+ const uint32_t* pTable = m_VertMetrics.GetData();
+ for (uint32_t i = 0; i < vertsize; i++)
if (pTable[i * 5] <= CID && pTable[i * 5 + 1] >= CID) {
return (short)(int)pTable[i * 5 + 2];
}
return m_DefaultW1;
}
void CPDF_CIDFont::GetVertOrigin(uint16_t CID, short& vx, short& vy) const {
- FX_DWORD vertsize = m_VertMetrics.GetSize() / 5;
+ uint32_t vertsize = m_VertMetrics.GetSize() / 5;
if (vertsize) {
- const FX_DWORD* pTable = m_VertMetrics.GetData();
- for (FX_DWORD i = 0; i < vertsize; i++)
+ const uint32_t* pTable = m_VertMetrics.GetData();
+ for (uint32_t i = 0; i < vertsize; i++)
if (pTable[i * 5] <= CID && pTable[i * 5 + 1] >= CID) {
vx = (short)(int)pTable[i * 5 + 3];
vy = (short)(int)pTable[i * 5 + 4];
return;
}
}
- FX_DWORD dwWidth = m_DefaultWidth;
+ uint32_t dwWidth = m_DefaultWidth;
int size = m_WidthList.GetSize();
- const FX_DWORD* list = m_WidthList.GetData();
+ const uint32_t* list = m_WidthList.GetData();
for (int i = 0; i < size; i += 3) {
if (CID >= list[i] && CID <= list[i + 1]) {
dwWidth = (uint16_t)list[i + 2];
@@ -587,7 +587,7 @@ void CPDF_CIDFont::GetVertOrigin(uint16_t CID, short& vx, short& vy) const {
vx = (short)dwWidth / 2;
vy = (short)m_DefaultVY;
}
-int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL* pVertGlyph) {
+int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, FX_BOOL* pVertGlyph) {
if (pVertGlyph) {
*pVertGlyph = FALSE;
}
@@ -637,7 +637,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL* pVertGlyph) {
}
return index;
}
-int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
+int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) {
if (pVertGlyph) {
*pVertGlyph = FALSE;
}
@@ -695,7 +695,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
if (bMSUnicode) {
index = FXFT_Get_Char_Index(face, unicode);
} else if (bMacRoman) {
- FX_DWORD maccode =
+ uint32_t maccode =
FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode);
index = !maccode ? FXFT_Get_Name_Index(face, (char*)name)
: FXFT_Get_Char_Index(face, maccode);
@@ -726,7 +726,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
if (err != 0) {
int i;
for (i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) {
- FX_DWORD ret = FT_CharCodeFromUnicode(
+ uint32_t ret = FT_CharCodeFromUnicode(
FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]),
(FX_WCHAR)charcode);
if (ret == 0) {
@@ -776,25 +776,25 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
return GetGlyphIndex(charcode, pVertGlyph);
}
}
- FX_DWORD byte_pos = cid * 2;
+ uint32_t byte_pos = cid * 2;
if (byte_pos + 2 > m_pCIDToGIDMap->GetSize())
return -1;
const uint8_t* pdata = m_pCIDToGIDMap->GetData() + byte_pos;
return pdata[0] * 256 + pdata[1];
}
-FX_DWORD CPDF_CIDFont::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_CIDFont::GetNextChar(const FX_CHAR* pString,
int nStrLen,
int& offset) const {
return m_pCMap->GetNextChar(pString, nStrLen, offset);
}
-int CPDF_CIDFont::GetCharSize(FX_DWORD charcode) const {
+int CPDF_CIDFont::GetCharSize(uint32_t charcode) const {
return m_pCMap->GetCharSize(charcode);
}
int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const {
return m_pCMap->CountChar(pString, size);
}
-int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const {
+int CPDF_CIDFont::AppendChar(FX_CHAR* str, uint32_t charcode) const {
return m_pCMap->AppendChar(str, charcode);
}
FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const {
@@ -804,7 +804,7 @@ FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const {
}
return TRUE;
}
-FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const {
+FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(uint32_t charcode) const {
return TRUE;
}
void CPDF_CIDFont::LoadSubstFont() {
@@ -812,14 +812,14 @@ void CPDF_CIDFont::LoadSubstFont() {
g_CharsetCPs[m_Charset], IsVertWriting());
}
void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
- CFX_ArrayTemplate<FX_DWORD>& result,
+ CFX_ArrayTemplate<uint32_t>& result,
int nElements) {
int width_status = 0;
int iCurElement = 0;
int first_code = 0;
int last_code = 0;
- FX_DWORD count = pArray->GetCount();
- for (FX_DWORD i = 0; i < count; i++) {
+ uint32_t count = pArray->GetCount();
+ for (uint32_t i = 0; i < count; i++) {
CPDF_Object* pObj = pArray->GetElementValue(i);
if (!pObj)
continue;
@@ -828,8 +828,8 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
if (width_status != 1)
return;
- FX_DWORD count = pArray->GetCount();
- for (FX_DWORD j = 0; j < count; j += nElements) {
+ uint32_t count = pArray->GetCount();
+ for (uint32_t j = 0; j < count; j += nElements) {
result.Add(first_code);
result.Add(first_code);
for (int k = 0; k < nElements; k++) {
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.h b/core/fpdfapi/fpdf_font/cpdf_cidfont.h
index 6405d2c342..9beb7cb107 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.h
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.h
@@ -38,35 +38,35 @@ class CPDF_CIDFont : public CPDF_Font {
bool IsCIDFont() const override;
const CPDF_CIDFont* AsCIDFont() const override;
CPDF_CIDFont* AsCIDFont() override;
- int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override;
- int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
- FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override;
- FX_DWORD GetNextChar(const FX_CHAR* pString,
+ int GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph = NULL) override;
+ int GetCharWidthF(uint32_t charcode, int level = 0) override;
+ FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override;
+ uint32_t GetNextChar(const FX_CHAR* pString,
int nStrLen,
int& offset) const override;
int CountChar(const FX_CHAR* pString, int size) const override;
- int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override;
- int GetCharSize(FX_DWORD charcode) const override;
+ int AppendChar(FX_CHAR* str, uint32_t charcode) const override;
+ int GetCharSize(uint32_t charcode) const override;
FX_BOOL IsVertWriting() const override;
FX_BOOL IsUnicodeCompatible() const override;
FX_BOOL Load() override;
- CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const override;
- FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const override;
+ CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
FX_BOOL LoadGB2312();
- uint16_t CIDFromCharCode(FX_DWORD charcode) const;
+ uint16_t CIDFromCharCode(uint32_t charcode) const;
const uint8_t* GetCIDTransform(uint16_t CID) const;
short GetVertWidth(uint16_t CID) const;
void GetVertOrigin(uint16_t CID, short& vx, short& vy) const;
- virtual FX_BOOL IsFontStyleFromCharCode(FX_DWORD charcode) const;
+ virtual FX_BOOL IsFontStyleFromCharCode(uint32_t charcode) const;
protected:
- int GetGlyphIndex(FX_DWORD unicodeb, FX_BOOL* pVertGlyph);
+ int GetGlyphIndex(uint32_t unicodeb, FX_BOOL* pVertGlyph);
void LoadMetricsArray(CPDF_Array* pArray,
- CFX_ArrayTemplate<FX_DWORD>& result,
+ CFX_ArrayTemplate<uint32_t>& result,
int nElements);
void LoadSubstFont();
- FX_WCHAR GetUnicodeFromCharCode(FX_DWORD charcode) const;
+ FX_WCHAR GetUnicodeFromCharCode(uint32_t charcode) const;
CPDF_CMap* m_pCMap;
CPDF_CMap* m_pAllocatedCMap;
@@ -78,10 +78,10 @@ class CPDF_CIDFont : public CPDF_Font {
uint16_t m_DefaultWidth;
uint16_t* m_pAnsiWidths;
FX_SMALL_RECT m_CharBBox[256];
- CFX_ArrayTemplate<FX_DWORD> m_WidthList;
+ CFX_ArrayTemplate<uint32_t> m_WidthList;
short m_DefaultVY;
short m_DefaultW1;
- CFX_ArrayTemplate<FX_DWORD> m_VertMetrics;
+ CFX_ArrayTemplate<uint32_t> m_VertMetrics;
FX_BOOL m_bAdobeCourierStd;
CFX_CTTGSUBTable* m_pTTGSUBTable;
};
diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp
index bb63966161..c52ce8ff93 100644
--- a/core/fpdfapi/fpdf_font/cpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp
@@ -121,16 +121,16 @@ int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const {
return size;
}
-int CPDF_Font::GetCharSize(FX_DWORD charcode) const {
+int CPDF_Font::GetCharSize(uint32_t charcode) const {
return 1;
}
-int CPDF_Font::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
+int CPDF_Font::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) {
ASSERT(false);
return 0;
}
-int CPDF_Font::GlyphFromCharCodeExt(FX_DWORD charcode) {
+int CPDF_Font::GlyphFromCharCodeExt(uint32_t charcode) {
return GlyphFromCharCode(charcode);
}
@@ -145,12 +145,12 @@ FX_BOOL CPDF_Font::IsVertWriting() const {
return bVertWriting;
}
-int CPDF_Font::AppendChar(FX_CHAR* buf, FX_DWORD charcode) const {
+int CPDF_Font::AppendChar(FX_CHAR* buf, uint32_t charcode) const {
*buf = (FX_CHAR)charcode;
return 1;
}
-void CPDF_Font::AppendChar(CFX_ByteString& str, FX_DWORD charcode) const {
+void CPDF_Font::AppendChar(CFX_ByteString& str, uint32_t charcode) const {
char buf[4];
int len = AppendChar(buf, charcode);
if (len == 1) {
@@ -160,7 +160,7 @@ void CPDF_Font::AppendChar(CFX_ByteString& str, FX_DWORD charcode) const {
}
}
-CFX_WideString CPDF_Font::UnicodeFromCharCode(FX_DWORD charcode) const {
+CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
if (!m_bToUnicodeLoaded)
((CPDF_Font*)this)->LoadUnicodeMap();
@@ -169,7 +169,7 @@ CFX_WideString CPDF_Font::UnicodeFromCharCode(FX_DWORD charcode) const {
return CFX_WideString();
}
-FX_DWORD CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const {
+uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const {
if (!m_bToUnicodeLoaded)
((CPDF_Font*)this)->LoadUnicodeMap();
@@ -237,7 +237,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
return;
const uint8_t* pFontData = m_pFontFile->GetData();
- FX_DWORD dwFontSize = m_pFontFile->GetSize();
+ uint32_t dwFontSize = m_pFontFile->GetSize();
if (!m_Font.LoadEmbedded(pFontData, dwFontSize)) {
m_pDocument->GetPageData()->ReleaseFontFileStreamAcc(
const_cast<CPDF_Stream*>(m_pFontFile->GetStream()->AsStream()));
@@ -305,7 +305,7 @@ int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) {
int offset = 0;
int width = 0;
while (offset < size) {
- FX_DWORD charcode = GetNextChar(pString, size, offset);
+ uint32_t charcode = GetNextChar(pString, size, offset);
width += GetCharWidthF(charcode);
}
return width;
@@ -387,14 +387,14 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
return pFont;
}
-FX_DWORD CPDF_Font::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_Font::GetNextChar(const FX_CHAR* pString,
int nStrLen,
int& offset) const {
if (offset < 0 || nStrLen < 1) {
return 0;
}
uint8_t ch = offset < nStrLen ? pString[offset++] : pString[nStrLen - 1];
- return static_cast<FX_DWORD>(ch);
+ return static_cast<uint32_t>(ch);
}
void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
@@ -450,8 +450,8 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
return;
}
pCharNames = new CFX_ByteString[256];
- FX_DWORD cur_code = 0;
- for (FX_DWORD i = 0; i < pDiffs->GetCount(); i++) {
+ uint32_t cur_code = 0;
+ for (uint32_t i = 0; i < pDiffs->GetCount(); i++) {
CPDF_Object* pElement = pDiffs->GetElementValue(i);
if (!pElement)
continue;
diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp
index 64e11e09de..3fc16a2c43 100644
--- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp
@@ -1631,8 +1631,8 @@ const FX_CHAR* const ZapfEncodingNames[224] = {
"a182", NULL, "a201", "a183", "a184", "a197", "a185", "a194", "a198",
"a186", "a195", "a187", "a188", "a189", "a190", "a191", NULL};
-FX_DWORD PDF_FindCode(const uint16_t* pCodes, uint16_t unicode) {
- for (FX_DWORD i = 0; i < 256; i++)
+uint32_t PDF_FindCode(const uint16_t* pCodes, uint16_t unicode) {
+ for (uint32_t i = 0; i < 256; i++)
if (pCodes[i] == unicode)
return i;
return 0;
@@ -1713,7 +1713,7 @@ CPDF_Object* CPDF_FontEncoding::Realize() {
return pDict;
}
-FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) {
+uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) {
switch (encoding) {
case FXFT_ENCODING_UNICODE:
return unicode;
@@ -1796,7 +1796,7 @@ const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
return nullptr;
}
-FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode) {
+FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode) {
switch (encoding) {
case FXFT_ENCODING_UNICODE:
return (uint16_t)charcode;
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
index d7057e1894..baac366e2a 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
@@ -22,7 +22,7 @@ CPDF_SimpleFont::~CPDF_SimpleFont() {
delete[] m_pCharNames;
}
-int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
+int CPDF_SimpleFont::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) {
if (pVertGlyph) {
*pVertGlyph = FALSE;
}
@@ -82,7 +82,7 @@ void CPDF_SimpleFont::LoadCharMetrics(int charcode) {
}
}
-int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) {
+int CPDF_SimpleFont::GetCharWidthF(uint32_t charcode, int level) {
if (charcode > 0xff) {
charcode = 0;
}
@@ -95,7 +95,7 @@ int CPDF_SimpleFont::GetCharWidthF(FX_DWORD charcode, int level) {
return (int16_t)m_CharWidth[charcode];
}
-FX_RECT CPDF_SimpleFont::GetCharBBox(FX_DWORD charcode, int level) {
+FX_RECT CPDF_SimpleFont::GetCharBBox(uint32_t charcode, int level) {
if (charcode > 0xff)
charcode = 0;
@@ -204,7 +204,7 @@ FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const {
m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS;
}
-CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(FX_DWORD charcode) const {
+CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
if (!unicode.IsEmpty())
return unicode;
@@ -214,8 +214,8 @@ CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(FX_DWORD charcode) const {
return ret;
}
-FX_DWORD CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
- FX_DWORD ret = CPDF_Font::CharCodeFromUnicode(unicode);
+uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
+ uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode);
if (ret)
return ret;
return m_Encoding.CharCodeFromUnicode(unicode);
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.h b/core/fpdfapi/fpdf_font/cpdf_simplefont.h
index 19d6816c9f..7b07c9971e 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.h
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.h
@@ -18,12 +18,12 @@ class CPDF_SimpleFont : public CPDF_Font {
virtual ~CPDF_SimpleFont();
// CPDF_Font:
- int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
- FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override;
- int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override;
+ int GetCharWidthF(uint32_t charcode, int level = 0) override;
+ FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override;
+ int GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph = NULL) override;
FX_BOOL IsUnicodeCompatible() const override;
- CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const override;
- FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const override;
+ CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
CPDF_FontEncoding* GetEncoding() { return &m_Encoding; }
diff --git a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
index 13e031808e..032fa00e96 100644
--- a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
@@ -112,7 +112,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
m_Font.GetFace(), m_Encoding.m_Unicodes[charcode]);
} else if (bMacRoman) {
- FX_DWORD maccode = FT_CharCodeFromUnicode(
+ uint32_t maccode = FT_CharCodeFromUnicode(
FXFT_ENCODING_APPLE_ROMAN, m_Encoding.m_Unicodes[charcode]);
if (!maccode) {
m_GlyphIndex[charcode] =
diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
index 5a6ee34362..b2f3ec898b 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
@@ -102,7 +102,7 @@ FX_BOOL CPDF_Type1Font::Load() {
return LoadCommon();
}
-int CPDF_Type1Font::GlyphFromCharCodeExt(FX_DWORD charcode) {
+int CPDF_Type1Font::GlyphFromCharCodeExt(uint32_t charcode) {
if (charcode > 0xff) {
return -1;
}
diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.h b/core/fpdfapi/fpdf_font/cpdf_type1font.h
index da82cd4417..188b766c8a 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type1font.h
+++ b/core/fpdfapi/fpdf_font/cpdf_type1font.h
@@ -18,7 +18,7 @@ class CPDF_Type1Font : public CPDF_SimpleFont {
bool IsType1Font() const override;
const CPDF_Type1Font* AsType1Font() const override;
CPDF_Type1Font* AsType1Font() override;
- int GlyphFromCharCodeExt(FX_DWORD charcode) override;
+ int GlyphFromCharCodeExt(uint32_t charcode) override;
int GetBase14Font() const { return m_Base14Font; }
diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
index 91a03a9830..8591b87be4 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
@@ -57,14 +57,14 @@ FX_BOOL CPDF_Type3Font::Load() {
int StartChar = m_pFontDict->GetIntegerBy("FirstChar");
CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
- FX_DWORD count = pWidthArray->GetCount();
+ uint32_t count = pWidthArray->GetCount();
if (count > 256) {
count = 256;
}
if (StartChar + count > 256) {
count = 256 - StartChar;
}
- for (FX_DWORD i = 0; i < count; i++) {
+ for (uint32_t i = 0; i < count; i++) {
m_CharWidthL[StartChar + i] =
FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
}
@@ -89,7 +89,7 @@ void CPDF_Type3Font::CheckType3FontMetrics() {
CheckFontMetrics();
}
-CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) {
+CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode, int level) {
if (level >= _FPDF_MAX_TYPE3_FORM_LEVEL_)
return nullptr;
@@ -145,7 +145,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) {
return pCachedChar;
}
-int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) {
+int CPDF_Type3Font::GetCharWidthF(uint32_t charcode, int level) {
if (charcode >= FX_ArraySize(m_CharWidthL))
charcode = 0;
@@ -156,7 +156,7 @@ int CPDF_Type3Font::GetCharWidthF(FX_DWORD charcode, int level) {
return pChar ? pChar->m_Width : 0;
}
-FX_RECT CPDF_Type3Font::GetCharBBox(FX_DWORD charcode, int level) {
+FX_RECT CPDF_Type3Font::GetCharBBox(uint32_t charcode, int level) {
const CPDF_Type3Char* pChar = LoadChar(charcode, level);
return pChar ? pChar->m_BBox : FX_RECT();
}
diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.h b/core/fpdfapi/fpdf_font/cpdf_type3font.h
index 554556934e..70992c9c8c 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type3font.h
+++ b/core/fpdfapi/fpdf_font/cpdf_type3font.h
@@ -25,13 +25,13 @@ class CPDF_Type3Font : public CPDF_SimpleFont {
bool IsType3Font() const override;
const CPDF_Type3Font* AsType3Font() const override;
CPDF_Type3Font* AsType3Font() override;
- int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
- FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override;
+ int GetCharWidthF(uint32_t charcode, int level = 0) override;
+ FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override;
void SetPageResources(CPDF_Dictionary* pResources) {
m_pPageResources = pResources;
}
- CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level = 0);
+ CPDF_Type3Char* LoadChar(uint32_t charcode, int level = 0);
void CheckType3FontMetrics();
CFX_Matrix& GetFontMatrix() { return m_FontMatrix; }
@@ -50,7 +50,7 @@ class CPDF_Type3Font : public CPDF_SimpleFont {
CPDF_Dictionary* m_pCharProcs;
CPDF_Dictionary* m_pPageResources;
CPDF_Dictionary* m_pFontResources;
- std::map<FX_DWORD, CPDF_Type3Char*> m_CacheMap;
+ std::map<uint32_t, CPDF_Type3Char*> m_CacheMap;
};
#endif // CORE_FPDFAPI_FPDF_FONT_CPDF_TYPE3FONT_H_
diff --git a/core/fpdfapi/fpdf_font/font_int.h b/core/fpdfapi/fpdf_font/font_int.h
index b9b5b5327d..3ee4068d7d 100644
--- a/core/fpdfapi/fpdf_font/font_int.h
+++ b/core/fpdfapi/fpdf_font/font_int.h
@@ -98,7 +98,7 @@ class CPDF_CMapParser {
friend class fpdf_font_cid_CMap_GetCode_Test;
friend class fpdf_font_cid_CMap_GetCodeRange_Test;
- static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word);
+ static uint32_t CMap_GetCode(const CFX_ByteStringC& word);
static bool CMap_GetCodeRange(CMap_CodeRange& range,
const CFX_ByteStringC& first,
const CFX_ByteStringC& second);
@@ -106,7 +106,7 @@ class CPDF_CMapParser {
CPDF_CMap* m_pCMap;
int m_Status;
int m_CodeSeq;
- FX_DWORD m_CodePoints[4];
+ uint32_t m_CodePoints[4];
CFX_ArrayTemplate<CMap_CodeRange> m_CodeRanges;
CFX_ByteString m_Registry, m_Ordering, m_Supplement;
CFX_ByteString m_LastWord;
@@ -136,16 +136,16 @@ class CPDF_CMap {
FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr,
const FX_CHAR* name,
FX_BOOL bPromptCJK);
- FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize);
+ FX_BOOL LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
void Release();
FX_BOOL IsLoaded() const { return m_bLoaded; }
FX_BOOL IsVertWriting() const { return m_bVertical; }
- uint16_t CIDFromCharCode(FX_DWORD charcode) const;
- FX_DWORD CharCodeFromCID(uint16_t CID) const;
- int GetCharSize(FX_DWORD charcode) const;
- FX_DWORD GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const;
+ uint16_t CIDFromCharCode(uint32_t charcode) const;
+ uint32_t CharCodeFromCID(uint16_t CID) const;
+ int GetCharSize(uint32_t charcode) const;
+ uint32_t GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const;
int CountChar(const FX_CHAR* pString, int size) const;
- int AppendChar(FX_CHAR* str, FX_DWORD charcode) const;
+ int AppendChar(FX_CHAR* str, uint32_t charcode) const;
protected:
~CPDF_CMap();
@@ -179,17 +179,17 @@ class CPDF_CID2UnicodeMap {
protected:
CIDSet m_Charset;
const uint16_t* m_pEmbeddedMap;
- FX_DWORD m_EmbeddedCount;
+ uint32_t m_EmbeddedCount;
};
class CPDF_ToUnicodeMap {
public:
void Load(CPDF_Stream* pStream);
- CFX_WideString Lookup(FX_DWORD charcode);
- FX_DWORD ReverseLookup(FX_WCHAR unicode);
+ CFX_WideString Lookup(uint32_t charcode);
+ uint32_t ReverseLookup(FX_WCHAR unicode);
protected:
- std::map<FX_DWORD, FX_DWORD> m_Map;
+ std::map<uint32_t, uint32_t> m_Map;
CPDF_CID2UnicodeMap* m_pBaseMap;
CFX_WideTextBuf m_MultiCharBuf;
@@ -197,12 +197,12 @@ class CPDF_ToUnicodeMap {
friend class fpdf_font_StringToCode_Test;
friend class fpdf_font_StringToWideString_Test;
- static FX_DWORD StringToCode(const CFX_ByteStringC& str);
+ static uint32_t StringToCode(const CFX_ByteStringC& str);
static CFX_WideString StringToWideString(const CFX_ByteStringC& str);
};
void FPDFAPI_LoadCID2UnicodeMap(CIDSet charset,
const uint16_t*& pMap,
- FX_DWORD& count);
+ uint32_t& count);
#endif // CORE_FPDFAPI_FPDF_FONT_FONT_INT_H_
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp
index c0c6f520f4..b0659b4a52 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -90,25 +90,24 @@ short TT2PDF(int m, FXFT_Face face) {
return (m * 1000 + upm / 2) / upm;
}
-
-CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) {
+CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) {
auto it = m_Map.find(charcode);
if (it != m_Map.end()) {
- FX_DWORD value = it->second;
+ uint32_t value = it->second;
FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff);
if (unicode != 0xffff) {
return unicode;
}
const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer();
- FX_DWORD buf_len = m_MultiCharBuf.GetLength();
+ uint32_t buf_len = m_MultiCharBuf.GetLength();
if (!buf || buf_len == 0) {
return CFX_WideString();
}
- FX_DWORD index = value >> 16;
+ uint32_t index = value >> 16;
if (index >= buf_len) {
return CFX_WideString();
}
- FX_DWORD len = buf[index];
+ uint32_t len = buf[index];
if (index + len < index || index + len >= buf_len) {
return CFX_WideString();
}
@@ -120,7 +119,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(FX_DWORD charcode) {
return CFX_WideString();
}
-FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) {
+uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) {
for (const auto& pair : m_Map) {
if (pair.second == unicode)
return pair.first;
@@ -129,7 +128,7 @@ FX_DWORD CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) {
}
// Static.
-FX_DWORD CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
+uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
const FX_CHAR* buf = str.GetCStr();
int len = str.GetLength();
if (len == 0)
@@ -209,7 +208,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
if (word.IsEmpty() || word == "endbfchar") {
break;
}
- FX_DWORD srccode = StringToCode(word);
+ uint32_t srccode = StringToCode(word);
word = parser.GetWord();
CFX_WideString destcode = StringToWideString(word);
int len = destcode.GetLength();
@@ -232,15 +231,15 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
break;
}
high = parser.GetWord();
- FX_DWORD lowcode = StringToCode(low);
- FX_DWORD highcode =
+ uint32_t lowcode = StringToCode(low);
+ uint32_t highcode =
(lowcode & 0xffffff00) | (StringToCode(high) & 0xff);
- if (highcode == (FX_DWORD)-1) {
+ if (highcode == (uint32_t)-1) {
break;
}
CFX_ByteString start = parser.GetWord();
if (start == "[") {
- for (FX_DWORD code = lowcode; code <= highcode; code++) {
+ for (uint32_t code = lowcode; code <= highcode; code++) {
CFX_ByteString dest = parser.GetWord();
CFX_WideString destcode = StringToWideString(dest);
int len = destcode.GetLength();
@@ -259,14 +258,14 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
} else {
CFX_WideString destcode = StringToWideString(start);
int len = destcode.GetLength();
- FX_DWORD value = 0;
+ uint32_t value = 0;
if (len == 1) {
value = StringToCode(start);
- for (FX_DWORD code = lowcode; code <= highcode; code++) {
+ for (uint32_t code = lowcode; code <= highcode; code++) {
m_Map[code] = value++;
}
} else {
- for (FX_DWORD code = lowcode; code <= highcode; code++) {
+ for (uint32_t code = lowcode; code <= highcode; code++) {
CFX_WideString retcode;
if (code == lowcode) {
retcode = destcode;
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 95452a7227..2552a3c0a6 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -195,15 +195,15 @@ CFX_ByteString CMap_GetString(const CFX_ByteStringC& word) {
}
int CompareDWORD(const void* data1, const void* data2) {
- return (*(FX_DWORD*)data1) - (*(FX_DWORD*)data2);
+ return (*(uint32_t*)data1) - (*(uint32_t*)data2);
}
int CompareCID(const void* key, const void* element) {
- if ((*(FX_DWORD*)key) < (*(FX_DWORD*)element)) {
+ if ((*(uint32_t*)key) < (*(uint32_t*)element)) {
return -1;
}
- if ((*(FX_DWORD*)key) >
- (*(FX_DWORD*)element) + ((FX_DWORD*)element)[1] / 65536) {
+ if ((*(uint32_t*)key) >
+ (*(uint32_t*)element) + ((uint32_t*)element)[1] / 65536) {
return 1;
}
return 0;
@@ -237,7 +237,7 @@ int CheckCodeRange(uint8_t* codes,
return 0;
}
-int GetCharSizeImpl(FX_DWORD charcode,
+int GetCharSizeImpl(uint32_t charcode,
CMap_CodeRange* pRanges,
int iRangesSize) {
if (!iRangesSize)
@@ -379,7 +379,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
} else if (m_Status == 1 || m_Status == 2) {
m_CodePoints[m_CodeSeq] = CMap_GetCode(word);
m_CodeSeq++;
- FX_DWORD StartCode, EndCode;
+ uint32_t StartCode, EndCode;
uint16_t StartCID;
if (m_Status == 1) {
if (m_CodeSeq < 2) {
@@ -396,11 +396,11 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
StartCID = (uint16_t)m_CodePoints[2];
}
if (EndCode < 0x10000) {
- for (FX_DWORD code = StartCode; code <= EndCode; code++) {
+ for (uint32_t code = StartCode; code <= EndCode; code++) {
m_pCMap->m_pMapping[code] = (uint16_t)(StartCID + code - StartCode);
}
} else {
- FX_DWORD buf[2];
+ uint32_t buf[2];
buf[0] = StartCode;
buf[1] = ((EndCode - StartCode) << 16) + StartCID;
m_AddMaps.AppendBlock(buf, sizeof buf);
@@ -451,7 +451,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
}
// Static.
-FX_DWORD CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
+uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
int num = 0;
if (word.GetAt(0) == '<') {
for (int i = 1; i < word.GetLength() && std::isxdigit(word.GetAt(i)); ++i)
@@ -487,12 +487,12 @@ bool CPDF_CMapParser::CMap_GetCodeRange(CMap_CodeRange& range,
range.m_Lower[i] = FXSYS_toHexDigit(digit1) * 16 + FXSYS_toHexDigit(digit2);
}
- FX_DWORD size = second.GetLength();
+ uint32_t size = second.GetLength();
for (i = 0; i < range.m_CharSize; ++i) {
- uint8_t digit1 = ((FX_DWORD)i * 2 + 1 < size)
+ uint8_t digit1 = ((uint32_t)i * 2 + 1 < size)
? second.GetAt((FX_STRSIZE)i * 2 + 1)
: '0';
- uint8_t digit2 = ((FX_DWORD)i * 2 + 2 < size)
+ uint8_t digit2 = ((uint32_t)i * 2 + 2 < size)
? second.GetAt((FX_STRSIZE)i * 2 + 2)
: '0';
range.m_Upper[i] = FXSYS_toHexDigit(digit1) * 16 + FXSYS_toHexDigit(digit2);
@@ -555,7 +555,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
m_CodingScheme = map->m_CodingScheme;
if (m_CodingScheme == MixedTwoBytes) {
m_pLeadingBytes = FX_Alloc(uint8_t, 256);
- for (FX_DWORD i = 0; i < map->m_LeadingSegCount; ++i) {
+ for (uint32_t i = 0; i < map->m_LeadingSegCount; ++i) {
const uint8_t* segs = map->m_LeadingSegs;
for (int b = segs[i * 2]; b <= segs[i * 2 + 1]; ++b) {
m_pLeadingBytes[b] = 1;
@@ -569,7 +569,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
}
return FALSE;
}
-FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) {
+FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
m_pMapping = FX_Alloc(uint16_t, 65536);
CPDF_CMapParser parser;
parser.Initialize(this);
@@ -583,7 +583,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) {
}
if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) {
m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4);
- *(FX_DWORD*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8;
+ *(uint32_t*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8;
FXSYS_memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(),
parser.m_AddMaps.GetSize());
FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8,
@@ -592,7 +592,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size) {
return TRUE;
}
-uint16_t CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const {
+uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const {
if (m_Coding == CIDCODING_CID) {
return (uint16_t)charcode;
}
@@ -605,27 +605,27 @@ uint16_t CPDF_CMap::CIDFromCharCode(FX_DWORD charcode) const {
if (charcode >> 16) {
if (m_pAddMapping) {
void* found = FXSYS_bsearch(&charcode, m_pAddMapping + 4,
- *(FX_DWORD*)m_pAddMapping, 8, CompareCID);
+ *(uint32_t*)m_pAddMapping, 8, CompareCID);
if (!found) {
if (m_pUseMap) {
return m_pUseMap->CIDFromCharCode(charcode);
}
return 0;
}
- return (uint16_t)(((FX_DWORD*)found)[1] % 65536 + charcode -
- *(FX_DWORD*)found);
+ return (uint16_t)(((uint32_t*)found)[1] % 65536 + charcode -
+ *(uint32_t*)found);
}
if (m_pUseMap)
return m_pUseMap->CIDFromCharCode(charcode);
return 0;
}
- FX_DWORD CID = m_pMapping[charcode];
+ uint32_t CID = m_pMapping[charcode];
if (!CID && m_pUseMap)
return m_pUseMap->CIDFromCharCode(charcode);
return (uint16_t)CID;
}
-FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_CMap::GetNextChar(const FX_CHAR* pString,
int nStrLen,
int& offset) const {
switch (m_CodingScheme) {
@@ -654,7 +654,7 @@ FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString,
return 0;
}
if (ret == 2) {
- FX_DWORD charcode = 0;
+ uint32_t charcode = 0;
for (int i = 0; i < char_size; i++) {
charcode = (charcode << 8) + codes[i];
}
@@ -670,7 +670,7 @@ FX_DWORD CPDF_CMap::GetNextChar(const FX_CHAR* pString,
}
return 0;
}
-int CPDF_CMap::GetCharSize(FX_DWORD charcode) const {
+int CPDF_CMap::GetCharSize(uint32_t charcode) const {
switch (m_CodingScheme) {
case OneByte:
return 1;
@@ -719,7 +719,7 @@ int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const {
return size;
}
-int CPDF_CMap::AppendChar(FX_CHAR* str, FX_DWORD charcode) const {
+int CPDF_CMap::AppendChar(FX_CHAR* str, uint32_t charcode) const {
switch (m_CodingScheme) {
case OneByte:
str[0] = (uint8_t)charcode;
diff --git a/core/fpdfapi/fpdf_font/include/cpdf_font.h b/core/fpdfapi/fpdf_font/include/cpdf_font.h
index 1931c245de..79456aa7a5 100644
--- a/core/fpdfapi/fpdf_font/include/cpdf_font.h
+++ b/core/fpdfapi/fpdf_font/include/cpdf_font.h
@@ -39,7 +39,7 @@ class CPDF_Font {
CPDF_Dictionary* pFontDict);
static CPDF_Font* GetStockFont(CPDF_Document* pDoc,
const CFX_ByteStringC& fontname);
- static const FX_DWORD kInvalidCharCode = static_cast<FX_DWORD>(-1);
+ static const uint32_t kInvalidCharCode = static_cast<uint32_t>(-1);
virtual ~CPDF_Font();
@@ -58,27 +58,27 @@ class CPDF_Font {
virtual FX_BOOL IsVertWriting() const;
virtual FX_BOOL IsUnicodeCompatible() const;
- virtual FX_DWORD GetNextChar(const FX_CHAR* pString,
+ virtual uint32_t GetNextChar(const FX_CHAR* pString,
int nStrLen,
int& offset) const;
virtual int CountChar(const FX_CHAR* pString, int size) const;
- virtual int AppendChar(FX_CHAR* buf, FX_DWORD charcode) const;
- virtual int GetCharSize(FX_DWORD charcode) const;
- virtual int GlyphFromCharCode(FX_DWORD charcode,
+ virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const;
+ virtual int GetCharSize(uint32_t charcode) const;
+ virtual int GlyphFromCharCode(uint32_t charcode,
FX_BOOL* pVertGlyph = nullptr);
- virtual int GlyphFromCharCodeExt(FX_DWORD charcode);
- virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const;
- virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const;
+ virtual int GlyphFromCharCodeExt(uint32_t charcode);
+ virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const;
+ virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const;
const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
const CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
- FX_DWORD GetFlags() const { return m_Flags; }
+ uint32_t GetFlags() const { return m_Flags; }
FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; }
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
FX_BOOL IsStandardFont() const;
FXFT_Face GetFace() const { return m_Font.GetFace(); }
- void AppendChar(CFX_ByteString& str, FX_DWORD charcode) const;
+ void AppendChar(CFX_ByteString& str, uint32_t charcode) const;
void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
int GetTypeAscent() const { return m_Ascent; }
@@ -87,8 +87,8 @@ class CPDF_Font {
int GetStemV() const { return m_StemV; }
int GetStringWidth(const FX_CHAR* pString, int size);
- virtual int GetCharWidthF(FX_DWORD charcode, int level = 0) = 0;
- virtual FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) = 0;
+ virtual int GetCharWidthF(uint32_t charcode, int level = 0) = 0;
+ virtual FX_RECT GetCharBBox(uint32_t charcode, int level = 0) = 0;
CPDF_Document* m_pDocument;
CFX_Font m_Font;
diff --git a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h b/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h
index a64687cd0e..6d6ff43814 100644
--- a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h
+++ b/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h
@@ -20,8 +20,8 @@
#define PDFFONT_ENCODING_MS_SYMBOL 8
#define PDFFONT_ENCODING_UNICODE 9
-FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode);
-FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode);
+uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode);
+FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name);
CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode);
diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/fpdfapi/fpdf_font/ttgsubtable.cpp
index 24825ec14e..bb1a6f9f22 100644
--- a/core/fpdfapi/fpdf_font/ttgsubtable.cpp
+++ b/core/fpdfapi/fpdf_font/ttgsubtable.cpp
@@ -16,7 +16,7 @@ CFX_GlyphMap::CFX_GlyphMap() {}
CFX_GlyphMap::~CFX_GlyphMap() {}
extern "C" {
static int _CompareInt(const void* p1, const void* p2) {
- return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2);
+ return (*(uint32_t*)p1) - (*(uint32_t*)p2);
}
};
struct _IntPair {
@@ -24,7 +24,7 @@ struct _IntPair {
int32_t value;
};
void CFX_GlyphMap::SetAt(int key, int value) {
- FX_DWORD count = m_Buffer.GetSize() / sizeof(_IntPair);
+ uint32_t count = m_Buffer.GetSize() / sizeof(_IntPair);
_IntPair* buf = (_IntPair*)m_Buffer.GetBuffer();
_IntPair pair = {key, value};
if (count == 0 || key > buf[count - 1].key) {
@@ -52,7 +52,7 @@ FX_BOOL CFX_GlyphMap::Lookup(int key, int& value) {
if (!pResult) {
return FALSE;
}
- value = ((FX_DWORD*)pResult)[1];
+ value = ((uint32_t*)pResult)[1];
return TRUE;
}
bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub) {
@@ -82,7 +82,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyph(uint32_t glyphnum,
k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j)
->LangSys.FeatureCount;
++k) {
- FX_DWORD index =
+ uint32_t index =
*(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j)
->LangSys.FeatureIndex +
k);
@@ -382,8 +382,8 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw,
rec->Substitute[i] = GetUInt16(sp);
}
}
-FX_BOOL CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum,
- FX_DWORD* vglyphnum) {
+FX_BOOL CFX_GSUBTable::GetVerticalGlyph(uint32_t glyphnum,
+ uint32_t* vglyphnum) {
return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum);
}
// static
diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.h b/core/fpdfapi/fpdf_font/ttgsubtable.h
index e0bdcc75e2..56f3fc01ea 100644
--- a/core/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/fpdfapi/fpdf_font/ttgsubtable.h
@@ -344,7 +344,7 @@ class CFX_CTTGSUBTable {
p += 4;
return ret;
}
- std::map<FX_DWORD, FX_DWORD> m_featureMap;
+ std::map<uint32_t, uint32_t> m_featureMap;
FX_BOOL m_bFeautureMapLoad;
bool loaded;
struct tt_gsub_header header;
@@ -355,7 +355,7 @@ class CFX_CTTGSUBTable {
class CFX_GSUBTable final : public IFX_GSUBTable {
public:
~CFX_GSUBTable() override {}
- FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override;
+ FX_BOOL GetVerticalGlyph(uint32_t glyphnum, uint32_t* vglyphnum) override;
CFX_CTTGSUBTable m_GsubImp;
};
diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
index 5d02381d2e..159de584ee 100644
--- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
@@ -47,7 +47,7 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray,
CFX_GraphStateData* pData = m_GraphState.GetModify();
pData->m_DashPhase = phase * scale;
pData->SetDashCount(pArray->GetCount());
- for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
+ for (uint32_t i = 0; i < pArray->GetCount(); i++) {
pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale;
}
}
@@ -62,7 +62,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
if (!pObject)
continue;
- FX_DWORD key = key_str.GetID();
+ uint32_t key = key_str.GetID();
switch (key) {
case FXBSTR_ID('L', 'W', 0, 0):
m_GraphState.GetModify()->m_LineWidth = pObject->GetNumber();
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index b1b464471d..3add21cfed 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -364,7 +364,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) {
return ColorspaceFromName(familyname);
CPDF_ColorSpace* pCS = NULL;
- FX_DWORD id = familyname.GetID();
+ uint32_t id = familyname.GetID();
if (id == FXBSTR_ID('C', 'a', 'l', 'G')) {
pCS = new CPDF_CalGray(pDoc);
} else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) {
@@ -930,8 +930,8 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
uint8_t* temp_src = FX_Alloc2D(uint8_t, nMaxColors, m_nComponents);
uint8_t* pSrc = temp_src;
for (int i = 0; i < nMaxColors; i++) {
- FX_DWORD color = i;
- FX_DWORD order = nMaxColors / 52;
+ uint32_t color = i;
+ uint32_t order = nMaxColors / 52;
for (int c = 0; c < m_nComponents; c++) {
*pSrc++ = (uint8_t)(color / order * 5);
color %= order;
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
index 81e5e41d60..7f80c82a03 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorstate.cpp
@@ -25,7 +25,7 @@ void CPDF_ColorState::SetStrokeColor(CPDF_ColorSpace* pCS,
}
void CPDF_ColorState::SetColor(CPDF_Color& color,
- FX_DWORD& rgb,
+ uint32_t& rgb,
CPDF_ColorSpace* pCS,
FX_FLOAT* pValue,
int nValues) {
@@ -39,7 +39,7 @@ void CPDF_ColorState::SetColor(CPDF_Color& color,
}
color.SetValue(pValue);
int R, G, B;
- rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1;
+ rgb = color.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
}
void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
@@ -54,7 +54,7 @@ void CPDF_ColorState::SetFillPattern(CPDF_Pattern* pPattern,
pData->m_FillRGB = 0x00BFBFBF;
return;
}
- pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1;
+ pData->m_FillRGB = ret ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
}
void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
@@ -70,5 +70,5 @@ void CPDF_ColorState::SetStrokePattern(CPDF_Pattern* pPattern,
return;
}
pData->m_StrokeRGB =
- pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (FX_DWORD)-1;
+ pData->m_StrokeColor.GetRGB(R, G, B) ? FXSYS_RGB(R, G, B) : (uint32_t)-1;
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstate.h b/core/fpdfapi/fpdf_page/cpdf_colorstate.h
index e7f3e37d35..2b27d07702 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorstate.h
+++ b/core/fpdfapi/fpdf_page/cpdf_colorstate.h
@@ -32,7 +32,7 @@ class CPDF_ColorState : public CFX_CountRef<CPDF_ColorStateData> {
private:
void SetColor(CPDF_Color& color,
- FX_DWORD& rgb,
+ uint32_t& rgb,
CPDF_ColorSpace* pCS,
FX_FLOAT* pValue,
int nValues);
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h b/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h
index 96e43bd9f3..6a992ad0b1 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h
+++ b/core/fpdfapi/fpdf_page/cpdf_colorstatedata.h
@@ -18,9 +18,9 @@ class CPDF_ColorStateData {
void Default();
CPDF_Color m_FillColor;
- FX_DWORD m_FillRGB;
+ uint32_t m_FillRGB;
CPDF_Color m_StrokeColor;
- FX_DWORD m_StrokeRGB;
+ uint32_t m_StrokeRGB;
};
#endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_COLORSTATEDATA_H_
diff --git a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp
index 11c4dc7701..45a40cc85c 100644
--- a/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_generalstate.cpp
@@ -9,7 +9,7 @@
namespace {
int RI_StringToId(const CFX_ByteString& ri) {
- FX_DWORD id = ri.GetID();
+ uint32_t id = ri.GetID();
if (id == FXBSTR_ID('A', 'b', 's', 'o'))
return 1;
diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp
index 7b114841be..d5c97807e9 100644
--- a/core/fpdfapi/fpdf_page/cpdf_image.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp
@@ -74,7 +74,7 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) {
return TRUE;
}
-CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) {
+CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
int32_t width;
int32_t height;
int32_t num_comps;
@@ -120,7 +120,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) {
return pDict;
}
-void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) {
+void CPDF_Image::SetJpegImage(uint8_t* pData, uint32_t size) {
CPDF_Dictionary* pDict = InitJPEG(pData, size);
if (!pDict) {
return;
@@ -129,11 +129,11 @@ void CPDF_Image::SetJpegImage(uint8_t* pData, FX_DWORD size) {
}
void CPDF_Image::SetJpegImage(IFX_FileRead* pFile) {
- FX_DWORD size = (FX_DWORD)pFile->GetSize();
+ uint32_t size = (uint32_t)pFile->GetSize();
if (!size) {
return;
}
- FX_DWORD dwEstimateSize = size;
+ uint32_t dwEstimateSize = size;
if (dwEstimateSize > 8192) {
dwEstimateSize = 8192;
}
@@ -221,7 +221,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
uint8_t* pColorTable = FX_Alloc2D(uint8_t, iPalette, 3);
uint8_t* ptr = pColorTable;
for (int32_t i = 0; i < iPalette; i++) {
- FX_DWORD argb = pBitmap->GetPaletteArgb(i);
+ uint32_t argb = pBitmap->GetPaletteArgb(i);
ptr[0] = (uint8_t)(argb >> 16);
ptr[1] = (uint8_t)(argb >> 8);
ptr[2] = (uint8_t)argb;
@@ -357,9 +357,9 @@ void CPDF_Image::ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pBitmap) {
}
CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask,
- FX_DWORD* pMatteColor,
+ uint32_t* pMatteColor,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask) const {
std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource);
if (source->Load(m_pDocument, m_pStream,
@@ -385,7 +385,7 @@ CFX_DIBSource* CPDF_Image::DetachMask() {
FX_BOOL CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource,
CPDF_Dictionary* pPageResource,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask) {
std::unique_ptr<CPDF_DIBSource> source(new CPDF_DIBSource);
int ret =
diff --git a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp
index 1d983d2b25..f4a1c16754 100644
--- a/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_meshstream.cpp
@@ -26,7 +26,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream,
if (!m_nCoordBits || !m_nCompBits)
return FALSE;
- FX_DWORD nComps = pCS->CountComponents();
+ uint32_t nComps = pCS->CountComponents();
if (nComps > 8)
return FALSE;
@@ -44,14 +44,14 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream,
m_xmax = pDecode->GetNumberAt(1);
m_ymin = pDecode->GetNumberAt(2);
m_ymax = pDecode->GetNumberAt(3);
- for (FX_DWORD i = 0; i < m_nComps; i++) {
+ for (uint32_t i = 0; i < m_nComps; i++) {
m_ColorMin[i] = pDecode->GetNumberAt(i * 2 + 4);
m_ColorMax[i] = pDecode->GetNumberAt(i * 2 + 5);
}
return TRUE;
}
-FX_DWORD CPDF_MeshStream::GetFlag() {
+uint32_t CPDF_MeshStream::GetFlag() {
return m_BitStream.GetBits(m_nFlagBits) & 0x03;
}
@@ -70,7 +70,7 @@ void CPDF_MeshStream::GetCoords(FX_FLOAT& x, FX_FLOAT& y) {
}
void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) {
- FX_DWORD i;
+ uint32_t i;
FX_FLOAT color_value[8];
for (i = 0; i < m_nComps; i++) {
color_value[i] = m_ColorMin[i] +
@@ -82,7 +82,7 @@ void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) {
FX_FLOAT result[kMaxResults];
int nResults;
FXSYS_memset(result, 0, sizeof(result));
- for (FX_DWORD i = 0; i < m_nFuncs; i++) {
+ for (uint32_t i = 0; i < m_nFuncs; i++) {
if (m_pFuncs[i] && m_pFuncs[i]->CountOutputs() <= kMaxResults) {
m_pFuncs[i]->Call(color_value, 1, result, nResults);
}
@@ -93,9 +93,9 @@ void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) {
}
}
-FX_DWORD CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex,
+uint32_t CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex,
CFX_Matrix* pObject2Bitmap) {
- FX_DWORD flag = GetFlag();
+ uint32_t flag = GetFlag();
GetCoords(vertex.x, vertex.y);
pObject2Bitmap->Transform(vertex.x, vertex.y);
GetColor(vertex.r, vertex.g, vertex.b);
diff --git a/core/fpdfapi/fpdf_page/cpdf_meshstream.h b/core/fpdfapi/fpdf_page/cpdf_meshstream.h
index 4934c0b133..462dcf09c7 100644
--- a/core/fpdfapi/fpdf_page/cpdf_meshstream.h
+++ b/core/fpdfapi/fpdf_page/cpdf_meshstream.h
@@ -31,25 +31,25 @@ class CPDF_MeshStream {
int nFuncs,
CPDF_ColorSpace* pCS);
- FX_DWORD GetFlag();
+ uint32_t GetFlag();
void GetCoords(FX_FLOAT& x, FX_FLOAT& y);
void GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b);
- FX_DWORD GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap);
+ uint32_t GetVertex(CPDF_MeshVertex& vertex, CFX_Matrix* pObject2Bitmap);
FX_BOOL GetVertexRow(CPDF_MeshVertex* vertex,
int count,
CFX_Matrix* pObject2Bitmap);
CPDF_Function** m_pFuncs;
CPDF_ColorSpace* m_pCS;
- FX_DWORD m_nFuncs;
- FX_DWORD m_nCoordBits;
- FX_DWORD m_nCompBits;
- FX_DWORD m_nFlagBits;
- FX_DWORD m_nComps;
- FX_DWORD m_CoordMax;
- FX_DWORD m_CompMax;
+ uint32_t m_nFuncs;
+ uint32_t m_nCoordBits;
+ uint32_t m_nCompBits;
+ uint32_t m_nFlagBits;
+ uint32_t m_nComps;
+ uint32_t m_CoordMax;
+ uint32_t m_CompMax;
FX_FLOAT m_xmin;
FX_FLOAT m_xmax;
FX_FLOAT m_ymin;
diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
index cf588dcf3d..7ca03b4f05 100644
--- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp
@@ -25,7 +25,7 @@ CPDF_TextObject::~CPDF_TextObject() {
void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const {
pInfo->m_CharCode =
- m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[index];
+ m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[index];
pInfo->m_OriginX = index ? m_pCharPos[index - 1] : 0;
pInfo->m_OriginY = 0;
if (pInfo->m_CharCode == -1) {
@@ -54,26 +54,26 @@ int CPDF_TextObject::CountChars() const {
}
int count = 0;
for (int i = 0; i < m_nChars; ++i)
- if (m_pCharCodes[i] != (FX_DWORD)-1) {
+ if (m_pCharCodes[i] != (uint32_t)-1) {
++count;
}
return count;
}
void CPDF_TextObject::GetCharInfo(int index,
- FX_DWORD& charcode,
+ uint32_t& charcode,
FX_FLOAT& kerning) const {
if (m_nChars == 1) {
- charcode = (FX_DWORD)(uintptr_t)m_pCharCodes;
+ charcode = (uint32_t)(uintptr_t)m_pCharCodes;
kerning = 0;
return;
}
int count = 0;
for (int i = 0; i < m_nChars; ++i) {
- if (m_pCharCodes[i] != (FX_DWORD)-1) {
+ if (m_pCharCodes[i] != (uint32_t)-1) {
if (count == index) {
charcode = m_pCharCodes[i];
- if (i == m_nChars - 1 || m_pCharCodes[i + 1] != (FX_DWORD)-1) {
+ if (i == m_nChars - 1 || m_pCharCodes[i + 1] != (uint32_t)-1) {
kerning = 0;
} else {
kerning = m_pCharPos[i];
@@ -92,8 +92,8 @@ void CPDF_TextObject::GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const {
}
int count = 0;
for (int i = 0; i < m_nChars; ++i) {
- FX_DWORD charcode = m_pCharCodes[i];
- if (charcode == (FX_DWORD)-1) {
+ uint32_t charcode = m_pCharCodes[i];
+ if (charcode == (uint32_t)-1) {
continue;
}
if (count == index) {
@@ -110,8 +110,8 @@ CPDF_TextObject* CPDF_TextObject::Clone() const {
obj->m_nChars = m_nChars;
if (m_nChars > 1) {
- obj->m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars);
- FXSYS_memcpy(obj->m_pCharCodes, m_pCharCodes, m_nChars * sizeof(FX_DWORD));
+ obj->m_pCharCodes = FX_Alloc(uint32_t, m_nChars);
+ FXSYS_memcpy(obj->m_pCharCodes, m_pCharCodes, m_nChars * sizeof(uint32_t));
obj->m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1);
FXSYS_memcpy(obj->m_pCharPos, m_pCharPos,
(m_nChars - 1) * sizeof(FX_FLOAT));
@@ -145,7 +145,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
}
m_nChars += nsegs - 1;
if (m_nChars > 1) {
- m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars);
+ m_pCharCodes = FX_Alloc(uint32_t, m_nChars);
m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1);
int index = 0;
for (int i = 0; i < nsegs; ++i) {
@@ -156,12 +156,12 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
}
if (i != nsegs - 1) {
m_pCharPos[index - 1] = pKerning[i];
- m_pCharCodes[index++] = (FX_DWORD)-1;
+ m_pCharCodes[index++] = (uint32_t)-1;
}
}
} else {
int offset = 0;
- m_pCharCodes = (FX_DWORD*)(uintptr_t)pFont->GetNextChar(
+ m_pCharCodes = (uint32_t*)(uintptr_t)pFont->GetNextChar(
pStrs[0], pStrs[0].GetLength(), offset);
}
}
@@ -171,7 +171,7 @@ void CPDF_TextObject::SetText(const CFX_ByteString& str) {
RecalcPositionData();
}
-FX_FLOAT CPDF_TextObject::GetCharWidth(FX_DWORD charcode) const {
+FX_FLOAT CPDF_TextObject::GetCharWidth(uint32_t charcode) const {
FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
CPDF_Font* pFont = m_TextState.GetFont();
FX_BOOL bVertWriting = FALSE;
@@ -203,10 +203,10 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
}
FX_FLOAT fontsize = m_TextState.GetFontSize();
for (int i = 0; i < m_nChars; ++i) {
- FX_DWORD charcode =
- m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
+ uint32_t charcode =
+ m_nChars == 1 ? (uint32_t)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
if (i > 0) {
- if (charcode == (FX_DWORD)-1) {
+ if (charcode == (uint32_t)-1) {
curpos -= (m_pCharPos[i - 1] * fontsize) / 1000;
continue;
}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index cc40976f29..224602ebc7 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -21,7 +21,7 @@
namespace {
-FX_DWORD ComponentsForFamily(int family) {
+uint32_t ComponentsForFamily(int family) {
if (family == PDFCS_DEVICERGB)
return 3;
if (family == PDFCS_DEVICEGRAY)
@@ -216,7 +216,7 @@ void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf,
}
}
-CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize)
+CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize)
: m_bsRGB(FALSE), m_pTransform(NULL), m_nSrcComponents(0) {
if (dwSize == 3144 &&
FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) {
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 2e68702127..d762e1aa53 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -477,7 +477,7 @@ CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) {
if (!pImageStream)
return nullptr;
- const FX_DWORD dwImageObjNum = pImageStream->GetObjNum();
+ const uint32_t dwImageObjNum = pImageStream->GetObjNum();
auto it = m_ImageMap.find(dwImageObjNum);
if (it != m_ImageMap.end()) {
return it->second->AddRef();
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 08eafad6ac..0fa2dd7712 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -490,7 +490,7 @@ static FX_FLOAT PDF_Interpolate(FX_FLOAT x,
FX_FLOAT ymax) {
return ((x - xmin) * (ymax - ymin) / (xmax - xmin)) + ymin;
}
-static FX_DWORD _GetBits32(const uint8_t* pData, int bitpos, int nbits) {
+static uint32_t _GetBits32(const uint8_t* pData, int bitpos, int nbits) {
int result = 0;
for (int i = 0; i < nbits; i++)
if (pData[(bitpos + i) / 8] & (1 << (7 - (bitpos + i) % 8))) {
@@ -515,8 +515,8 @@ class CPDF_SampledFunc : public CPDF_Function {
SampleEncodeInfo* m_pEncodeInfo;
SampleDecodeInfo* m_pDecodeInfo;
- FX_DWORD m_nBitsPerSample;
- FX_DWORD m_SampleMax;
+ uint32_t m_nBitsPerSample;
+ uint32_t m_SampleMax;
CPDF_StreamAcc* m_pSampleStream;
};
@@ -632,7 +632,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
return FALSE;
}
for (int j = 0; j < m_nOutputs; j++) {
- FX_DWORD sample =
+ uint32_t sample =
_GetBits32(pSampleData, bitpos.ValueOrDie() + j * m_nBitsPerSample,
m_nBitsPerSample);
FX_FLOAT encoded = (FX_FLOAT)sample;
@@ -650,7 +650,7 @@ FX_BOOL CPDF_SampledFunc::v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const {
if (!bitpos2.IsValid()) {
return FALSE;
}
- FX_DWORD sample1 =
+ uint32_t sample1 =
_GetBits32(pSampleData, bitpos2.ValueOrDie(), m_nBitsPerSample);
encoded += (encoded_input[i] - index[i]) *
((FX_FLOAT)sample1 - (FX_FLOAT)sample);
@@ -770,12 +770,12 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
if (!pArray) {
return FALSE;
}
- FX_DWORD nSubs = pArray->GetCount();
+ uint32_t nSubs = pArray->GetCount();
if (nSubs == 0) {
return FALSE;
}
m_nOutputs = 0;
- for (FX_DWORD i = 0; i < nSubs; i++) {
+ for (uint32_t i = 0; i < nSubs; i++) {
CPDF_Object* pSub = pArray->GetElementValue(i);
if (pSub == pObj) {
return FALSE;
@@ -804,7 +804,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
if (!pArray) {
return FALSE;
}
- for (FX_DWORD i = 0; i < nSubs - 1; i++) {
+ for (uint32_t i = 0; i < nSubs - 1; i++) {
m_pBounds[i + 1] = pArray->GetFloatAt(i);
}
m_pBounds[nSubs] = m_pDomains[1];
@@ -813,7 +813,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
if (!pArray) {
return FALSE;
}
- for (FX_DWORD i = 0; i < nSubs * 2; i++) {
+ for (uint32_t i = 0; i < nSubs * 2; i++) {
m_pEncode[i] = pArray->GetFloatAt(i);
}
return TRUE;
@@ -900,7 +900,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
m_pRanges[i] = pRanges->GetFloatAt(i);
}
}
- FX_DWORD old_outputs = m_nOutputs;
+ uint32_t old_outputs = m_nOutputs;
if (!v_Init(pObj)) {
return FALSE;
}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 63c84bbd22..75b745222f 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -255,8 +255,8 @@ void CPDF_StreamContentParser::AddObjectParam(CPDF_Object* pObj) {
m_ParamBuf[index].m_pObject = pObj;
}
void CPDF_StreamContentParser::ClearAllParams() {
- FX_DWORD index = m_ParamStartPos;
- for (FX_DWORD i = 0; i < m_ParamCount; i++) {
+ uint32_t index = m_ParamStartPos;
+ for (uint32_t i = 0; i < m_ParamCount; i++) {
if (m_ParamBuf[index].m_Type == 0) {
if (CPDF_Object* pObject = m_ParamBuf[index].m_pObject)
pObject->Release();
@@ -270,7 +270,7 @@ void CPDF_StreamContentParser::ClearAllParams() {
m_ParamCount = 0;
}
-CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) {
+CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
if (index >= m_ParamCount) {
return NULL;
}
@@ -302,7 +302,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(FX_DWORD index) {
return NULL;
}
-CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index) {
+CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
if (index >= m_ParamCount) {
return CFX_ByteString();
}
@@ -320,7 +320,7 @@ CFX_ByteString CPDF_StreamContentParser::GetString(FX_DWORD index) {
return CFX_ByteString();
}
-FX_FLOAT CPDF_StreamContentParser::GetNumber(FX_DWORD index) {
+FX_FLOAT CPDF_StreamContentParser::GetNumber(uint32_t index) {
if (index >= m_ParamCount) {
return 0;
}
@@ -339,7 +339,7 @@ FX_FLOAT CPDF_StreamContentParser::GetNumber(FX_DWORD index) {
return 0;
}
-FX_FLOAT CPDF_StreamContentParser::GetNumber16(FX_DWORD index) {
+FX_FLOAT CPDF_StreamContentParser::GetNumber16(uint32_t index) {
return GetNumber(index);
}
@@ -484,7 +484,7 @@ CPDF_StreamContentParser::InitializeOpCodes() {
void CPDF_StreamContentParser::OnOperator(const FX_CHAR* op) {
int i = 0;
- FX_DWORD opid = 0;
+ uint32_t opid = 0;
while (i < 4 && op[i]) {
opid = (opid << 8) + op[i];
i++;
@@ -574,7 +574,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj(
m_pSyntax->ReadNextObject());
if (!key.IsEmpty()) {
- FX_DWORD dwObjNum = pObj ? pObj->GetObjNum() : 0;
+ uint32_t dwObjNum = pObj ? pObj->GetObjNum() : 0;
if (dwObjNum)
pDict->SetAtReference(key, m_pDocument, dwObjNum);
else
@@ -1645,17 +1645,17 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) {
}
}
-FX_DWORD CPDF_StreamContentParser::Parse(const uint8_t* pData,
- FX_DWORD dwSize,
- FX_DWORD max_cost) {
+uint32_t CPDF_StreamContentParser::Parse(const uint8_t* pData,
+ uint32_t dwSize,
+ uint32_t max_cost) {
if (m_Level > _FPDF_MAX_FORM_LEVEL_) {
return dwSize;
}
- FX_DWORD InitObjCount = m_pObjectHolder->GetPageObjectList()->size();
+ uint32_t InitObjCount = m_pObjectHolder->GetPageObjectList()->size();
CPDF_StreamParser syntax(pData, dwSize);
CPDF_StreamParserAutoClearer auto_clearer(&m_pSyntax, &syntax);
while (1) {
- FX_DWORD cost = m_pObjectHolder->GetPageObjectList()->size() - InitObjCount;
+ uint32_t cost = m_pObjectHolder->GetPageObjectList()->size() - InitObjCount;
if (max_cost && cost >= max_cost) {
break;
}
@@ -1810,7 +1810,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
}
case CPDF_Object::ARRAY: {
CPDF_Array* pArray = pObj->AsArray();
- for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
+ for (uint32_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetElement(i);
if (pElement->IsName()) {
CFX_ByteString name = pElement->GetString();
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 9995038def..f2b7582a01 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -31,7 +31,7 @@
#include "core/fxcrt/include/fx_safe_types.h"
#include "core/include/fxcodec/fx_codec.h"
-CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize) {
+CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize) {
m_pBuf = pData;
m_Size = dwSize;
m_Pos = 0;
@@ -44,11 +44,11 @@ CPDF_StreamParser::~CPDF_StreamParser() {
}
}
-FX_DWORD DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder,
+uint32_t DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
if (!pDecoder) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
int ncomps = pDecoder->CountComps();
int bpc = pDecoder->GetBPC();
@@ -57,7 +57,7 @@ FX_DWORD DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder,
int pitch = (width * ncomps * bpc + 7) / 8;
if (height == 0 || pitch > (1 << 30) / height) {
delete pDecoder;
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
dest_buf = FX_Alloc2D(uint8_t, pitch, height);
dest_size = pitch * height; // Safe since checked alloc returned.
@@ -68,26 +68,26 @@ FX_DWORD DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder,
FXSYS_memcpy(dest_buf + row * pitch, pLine, pitch);
}
- FX_DWORD srcoff = pDecoder->GetSrcOffset();
+ uint32_t srcoff = pDecoder->GetSrcOffset();
delete pDecoder;
return srcoff;
}
ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
const CPDF_Dictionary* pParams);
-FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf,
- FX_DWORD limit,
+uint32_t PDF_DecodeInlineStream(const uint8_t* src_buf,
+ uint32_t limit,
int width,
int height,
CFX_ByteString& decoder,
CPDF_Dictionary* pParam,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
if (decoder == "CCITTFaxDecode" || decoder == "CCF") {
ICodec_ScanlineDecoder* pDecoder =
FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam);
@@ -119,7 +119,7 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf,
}
dest_size = 0;
dest_buf = 0;
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
}
CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
@@ -146,12 +146,12 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
pParam = pDict->GetDictBy("DecodeParms");
}
}
- FX_DWORD width = pDict->GetIntegerBy("Width");
- FX_DWORD height = pDict->GetIntegerBy("Height");
- FX_DWORD OrigSize = 0;
+ uint32_t width = pDict->GetIntegerBy("Width");
+ uint32_t height = pDict->GetIntegerBy("Height");
+ uint32_t OrigSize = 0;
if (pCSObj) {
- FX_DWORD bpc = pDict->GetIntegerBy("BitsPerComponent");
- FX_DWORD nComponents = 1;
+ uint32_t bpc = pDict->GetIntegerBy("BitsPerComponent");
+ uint32_t nComponents = 1;
CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj);
if (!pCS) {
nComponents = 3;
@@ -159,7 +159,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
nComponents = pCS->CountComponents();
pDoc->GetPageData()->ReleaseColorSpace(pCSObj);
}
- FX_DWORD pitch = width;
+ uint32_t pitch = width;
if (bpc && pitch > INT_MAX / bpc) {
return NULL;
}
@@ -185,7 +185,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
}
OrigSize *= height;
uint8_t* pData = NULL;
- FX_DWORD dwStreamSize;
+ uint32_t dwStreamSize;
if (Decoder.IsEmpty()) {
if (OrigSize > m_Size - m_Pos) {
OrigSize = m_Size - m_Pos;
@@ -195,7 +195,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
dwStreamSize = OrigSize;
m_Pos += OrigSize;
} else {
- FX_DWORD dwDestSize = OrigSize;
+ uint32_t dwDestSize = OrigSize;
dwStreamSize =
PDF_DecodeInlineStream(m_pBuf + m_Pos, m_Size - m_Pos, width, height,
Decoder, pParam, pData, dwDestSize);
@@ -217,10 +217,10 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
}
} else {
FX_Free(pData);
- FX_DWORD dwSavePos = m_Pos;
+ uint32_t dwSavePos = m_Pos;
m_Pos += dwStreamSize;
while (1) {
- FX_DWORD dwPrevPos = m_Pos;
+ uint32_t dwPrevPos = m_Pos;
CPDF_StreamParser::SyntaxType type = ParseNextElement();
if (type == CPDF_StreamParser::EndOfData) {
break;
@@ -332,7 +332,7 @@ CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() {
}
void CPDF_StreamParser::SkipPathObject() {
- FX_DWORD command_startpos = m_Pos;
+ uint32_t command_startpos = m_Pos;
if (!PositionIsInBounds())
return;
@@ -365,7 +365,7 @@ void CPDF_StreamParser::SkipPathObject() {
if (PDFCharIsNumeric(ch))
continue;
- FX_DWORD op_startpos = m_Pos - 1;
+ uint32_t op_startpos = m_Pos - 1;
while (!PDFCharIsWhitespace(ch) && !PDFCharIsDelimiter(ch)) {
if (!PositionIsInBounds())
return;
@@ -808,7 +808,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
}
m_Size = safeSize.ValueOrDie();
m_pData = FX_Alloc(uint8_t, m_Size);
- FX_DWORD pos = 0;
+ uint32_t pos = 0;
for (const auto& stream : m_StreamArray) {
FXSYS_memcpy(m_pData + pos, stream->GetData(), stream->GetSize());
pos += stream->GetSize();
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 822d06d84c..68ac8c849d 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -58,7 +58,7 @@ CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream,
color_count = kQuadColorsPerPatch;
while (!stream.m_BitStream.IsEOF()) {
- FX_DWORD flag = 0;
+ uint32_t flag = 0;
if (type != kLatticeFormGouraudTriangleMeshShading)
flag = stream.GetFlag();
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_clippath.h b/core/fpdfapi/fpdf_page/include/cpdf_clippath.h
index e265cd4ce0..6f239e661f 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_clippath.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_clippath.h
@@ -17,10 +17,10 @@ class CPDF_TextObject;
class CPDF_ClipPath : public CFX_CountRef<CPDF_ClipPathData> {
public:
- FX_DWORD GetPathCount() const { return m_pObject->m_PathCount; }
+ uint32_t GetPathCount() const { return m_pObject->m_PathCount; }
CPDF_Path GetPath(int i) const { return m_pObject->m_pPathList[i]; }
int GetClipType(int i) const { return m_pObject->m_pTypeList[i]; }
- FX_DWORD GetTextCount() const { return m_pObject->m_TextCount; }
+ uint32_t GetTextCount() const { return m_pObject->m_TextCount; }
CPDF_TextObject* GetText(int i) const { return m_pObject->m_pTextList[i]; }
CFX_FloatRect GetClipBox() const;
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h
index afdd71dc4d..6be55f47b9 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h
@@ -37,7 +37,7 @@ class CPDF_ColorSpace {
int GetBufSize() const;
FX_FLOAT* CreateBuf();
void GetDefaultColor(FX_FLOAT* buf) const;
- FX_DWORD CountComponents() const { return m_nComponents; }
+ uint32_t CountComponents() const { return m_nComponents; }
int GetFamily() const { return m_Family; }
virtual void GetDefaultValue(int iComponent,
FX_FLOAT& value,
@@ -87,7 +87,7 @@ class CPDF_ColorSpace {
CPDF_Document* const m_pDocument;
protected:
- CPDF_ColorSpace(CPDF_Document* pDoc, int family, FX_DWORD nComponents)
+ CPDF_ColorSpace(CPDF_Document* pDoc, int family, uint32_t nComponents)
: m_pDocument(pDoc),
m_Family(family),
m_nComponents(nComponents),
@@ -114,9 +114,9 @@ class CPDF_ColorSpace {
}
int m_Family;
- FX_DWORD m_nComponents;
+ uint32_t m_nComponents;
CPDF_Array* m_pArray;
- FX_DWORD m_dwStdConversion;
+ uint32_t m_dwStdConversion;
};
#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_COLORSPACE_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_image.h b/core/fpdfapi/fpdf_page/include/cpdf_image.h
index 9153e9a660..48349deb3b 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_image.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_image.h
@@ -52,14 +52,14 @@ class CPDF_Image {
FX_BOOL IsInterpol() const { return m_bInterpolate; }
CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = NULL,
- FX_DWORD* pMatteColor = NULL,
+ uint32_t* pMatteColor = NULL,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE) const;
void SetInlineDict(CPDF_Dictionary* pDict) { m_pInlineDict = pDict; }
void SetImage(const CFX_DIBitmap* pDIBitmap, int32_t iCompress);
- void SetJpegImage(uint8_t* pImageData, FX_DWORD size);
+ void SetJpegImage(uint8_t* pImageData, uint32_t size);
void SetJpegImage(IFX_FileRead* pFile);
void ResetCache(CPDF_Page* pPage, const CFX_DIBitmap* pDIBitmap);
@@ -67,7 +67,7 @@ class CPDF_Image {
FX_BOOL StartLoadDIBSource(CPDF_Dictionary* pFormResource,
CPDF_Dictionary* pPageResource,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE);
FX_BOOL Continue(IFX_Pause* pPause);
CFX_DIBSource* DetachBitmap();
@@ -75,10 +75,10 @@ class CPDF_Image {
CFX_DIBSource* m_pDIBSource;
CFX_DIBSource* m_pMask;
- FX_DWORD m_MatteColor;
+ uint32_t m_MatteColor;
private:
- CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size);
+ CPDF_Dictionary* InitJPEG(uint8_t* pData, uint32_t size);
CPDF_Stream* m_pStream;
FX_BOOL m_bInline;
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h
index bb268c1446..c47180ef6b 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h
@@ -12,7 +12,7 @@
#include "core/fxcrt/include/fx_system.h"
struct CPDF_TextObjectItem {
- FX_DWORD m_CharCode;
+ uint32_t m_CharCode;
FX_FLOAT m_OriginX;
FX_FLOAT m_OriginY;
};
@@ -33,9 +33,9 @@ class CPDF_TextObject : public CPDF_PageObject {
int CountItems() const { return m_nChars; }
void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const;
int CountChars() const;
- void GetCharInfo(int index, FX_DWORD& charcode, FX_FLOAT& kerning) const;
+ void GetCharInfo(int index, uint32_t& charcode, FX_FLOAT& kerning) const;
void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const;
- FX_FLOAT GetCharWidth(FX_DWORD charcode) const;
+ FX_FLOAT GetCharWidth(uint32_t charcode) const;
FX_FLOAT GetPosX() const { return m_PosX; }
FX_FLOAT GetPosY() const { return m_PosY; }
void GetTextMatrix(CFX_Matrix* pMatrix) const;
@@ -62,7 +62,7 @@ class CPDF_TextObject : public CPDF_PageObject {
FX_FLOAT m_PosX;
FX_FLOAT m_PosY;
int m_nChars;
- FX_DWORD* m_pCharCodes;
+ uint32_t* m_pCharCodes;
FX_FLOAT* m_pCharPos;
};
diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h
index 297b1e2e77..d76eea49d2 100644
--- a/core/fpdfapi/fpdf_page/pageint.h
+++ b/core/fpdfapi/fpdf_page/pageint.h
@@ -39,7 +39,7 @@ class CPDF_StreamParser {
public:
enum SyntaxType { EndOfData, Number, Keyword, Name, Others };
- CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize);
+ CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize);
~CPDF_StreamParser();
CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc,
@@ -48,14 +48,14 @@ class CPDF_StreamParser {
FX_BOOL bDecode);
SyntaxType ParseNextElement();
uint8_t* GetWordBuf() { return m_WordBuffer; }
- FX_DWORD GetWordSize() const { return m_WordSize; }
+ uint32_t GetWordSize() const { return m_WordSize; }
CPDF_Object* GetObject() {
CPDF_Object* pObj = m_pLastObj;
m_pLastObj = NULL;
return pObj;
}
- FX_DWORD GetPos() const { return m_Pos; }
- void SetPos(FX_DWORD pos) { m_Pos = pos; }
+ uint32_t GetPos() const { return m_Pos; }
+ void SetPos(uint32_t pos) { m_Pos = pos; }
CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE,
FX_BOOL bInArray = FALSE);
void SkipPathObject();
@@ -69,13 +69,13 @@ class CPDF_StreamParser {
const uint8_t* m_pBuf;
// Length in bytes of m_pBuf.
- FX_DWORD m_Size;
+ uint32_t m_Size;
// Current byte position within m_pBuf.
- FX_DWORD m_Pos;
+ uint32_t m_Pos;
uint8_t m_WordBuffer[256];
- FX_DWORD m_WordSize;
+ uint32_t m_WordSize;
CPDF_Object* m_pLastObj;
private:
@@ -128,14 +128,14 @@ class CPDF_StreamContentParser {
void AddNameParam(const FX_CHAR* name, int size);
int GetNextParamPos();
void ClearAllParams();
- CPDF_Object* GetObject(FX_DWORD index);
- CFX_ByteString GetString(FX_DWORD index);
- FX_FLOAT GetNumber(FX_DWORD index);
- FX_FLOAT GetNumber16(FX_DWORD index);
- int GetInteger(FX_DWORD index) { return (int32_t)(GetNumber(index)); }
+ CPDF_Object* GetObject(uint32_t index);
+ CFX_ByteString GetString(uint32_t index);
+ FX_FLOAT GetNumber(uint32_t index);
+ FX_FLOAT GetNumber16(uint32_t index);
+ int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); }
void OnOperator(const FX_CHAR* op);
void BigCaseCaller(int index);
- FX_DWORD GetParsePos() { return m_pSyntax->GetPos(); }
+ uint32_t GetParsePos() { return m_pSyntax->GetPos(); }
void AddTextObject(CFX_ByteString* pText,
FX_FLOAT fInitKerning,
FX_FLOAT* pKerning,
@@ -144,7 +144,7 @@ class CPDF_StreamContentParser {
void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y);
void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y);
void OnChangeTextMatrix();
- FX_DWORD Parse(const uint8_t* pData, FX_DWORD dwSize, FX_DWORD max_cost);
+ uint32_t Parse(const uint8_t* pData, uint32_t dwSize, uint32_t max_cost);
void ParsePathObject();
void AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag);
void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_FLOAT w, FX_FLOAT h);
@@ -168,7 +168,7 @@ class CPDF_StreamContentParser {
protected:
using OpCodes =
- std::unordered_map<FX_DWORD, void (CPDF_StreamContentParser::*)()>;
+ std::unordered_map<uint32_t, void (CPDF_StreamContentParser::*)()>;
static OpCodes InitializeOpCodes();
void Handle_CloseFillStrokePath();
@@ -254,8 +254,8 @@ class CPDF_StreamContentParser {
CFX_FloatRect m_BBox;
CPDF_ParseOptions m_Options;
ContentParam m_ParamBuf[PARAM_BUF_SIZE];
- FX_DWORD m_ParamStartPos;
- FX_DWORD m_ParamCount;
+ uint32_t m_ParamStartPos;
+ uint32_t m_ParamCount;
CPDF_StreamParser* m_pSyntax;
std::unique_ptr<CPDF_AllStates> m_pCurStates;
CPDF_ContentMark m_CurContentMark;
@@ -313,12 +313,12 @@ class CPDF_ContentParser {
FX_BOOL m_bForm;
CPDF_ParseOptions m_Options;
CPDF_Type3Char* m_pType3Char;
- FX_DWORD m_nStreams;
+ uint32_t m_nStreams;
std::unique_ptr<CPDF_StreamAcc> m_pSingleStream;
std::vector<std::unique_ptr<CPDF_StreamAcc>> m_StreamArray;
uint8_t* m_pData;
- FX_DWORD m_Size;
- FX_DWORD m_CurrentOffset;
+ uint32_t m_Size;
+ uint32_t m_CurrentOffset;
std::unique_ptr<CPDF_StreamContentParser> m_pParser;
};
@@ -361,7 +361,7 @@ class CPDF_DocPageData {
using CPDF_FontFileMap = std::map<CPDF_Stream*, CPDF_CountedStreamAcc*>;
using CPDF_FontMap = std::map<CPDF_Dictionary*, CPDF_CountedFont*>;
using CPDF_IccProfileMap = std::map<CPDF_Stream*, CPDF_CountedIccProfile*>;
- using CPDF_ImageMap = std::map<FX_DWORD, CPDF_CountedImage*>;
+ using CPDF_ImageMap = std::map<uint32_t, CPDF_CountedImage*>;
using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>;
CPDF_Document* const m_pPDFDoc;
@@ -441,14 +441,14 @@ class CPDF_StitchFunc : public CPDF_Function {
class CPDF_IccProfile {
public:
- CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize);
+ CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize);
~CPDF_IccProfile();
- FX_DWORD GetComponents() const { return m_nSrcComponents; }
+ uint32_t GetComponents() const { return m_nSrcComponents; }
FX_BOOL m_bsRGB;
void* m_pTransform;
private:
- FX_DWORD m_nSrcComponents;
+ uint32_t m_nSrcComponents;
};
class CPDF_DeviceCS : public CPDF_ColorSpace {
diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
index dec8fbdfaf..9cbf999702 100644
--- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp
@@ -40,7 +40,7 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
}
return pDoc;
}
-CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, FX_DWORD size) {
+CFDF_Document* CFDF_Document::ParseMemory(const uint8_t* pData, uint32_t size) {
return CFDF_Document::ParseFile(FX_CreateMemoryStream((uint8_t*)pData, size),
TRUE);
}
@@ -53,7 +53,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
bool bNumber;
CFX_ByteString word = parser.GetNextWord(&bNumber);
if (bNumber) {
- FX_DWORD objnum = FXSYS_atoui(word);
+ uint32_t objnum = FXSYS_atoui(word);
word = parser.GetNextWord(&bNumber);
if (!bNumber) {
break;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
index acd39a9390..69de5bbc26 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
@@ -76,43 +76,43 @@ CFX_Matrix CPDF_Array::GetMatrix() {
return matrix;
}
-CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CPDF_Object* CPDF_Array::GetElement(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return nullptr;
return m_Objects.GetAt(i);
}
-CPDF_Object* CPDF_Array::GetElementValue(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CPDF_Object* CPDF_Array::GetElementValue(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return nullptr;
return m_Objects.GetAt(i)->GetDirect();
}
-CFX_ByteString CPDF_Array::GetStringAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CFX_ByteString CPDF_Array::GetStringAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return CFX_ByteString();
return m_Objects.GetAt(i)->GetString();
}
-CFX_ByteStringC CPDF_Array::GetConstStringAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+CFX_ByteStringC CPDF_Array::GetConstStringAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return CFX_ByteStringC();
return m_Objects.GetAt(i)->GetConstString();
}
-int CPDF_Array::GetIntegerAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+int CPDF_Array::GetIntegerAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return 0;
return m_Objects.GetAt(i)->GetInteger();
}
-FX_FLOAT CPDF_Array::GetNumberAt(FX_DWORD i) const {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+FX_FLOAT CPDF_Array::GetNumberAt(uint32_t i) const {
+ if (i >= (uint32_t)m_Objects.GetSize())
return 0;
return m_Objects.GetAt(i)->GetNumber();
}
-CPDF_Dictionary* CPDF_Array::GetDictAt(FX_DWORD i) const {
+CPDF_Dictionary* CPDF_Array::GetDictAt(uint32_t i) const {
CPDF_Object* p = GetElementValue(i);
if (!p)
return NULL;
@@ -123,16 +123,16 @@ CPDF_Dictionary* CPDF_Array::GetDictAt(FX_DWORD i) const {
return NULL;
}
-CPDF_Stream* CPDF_Array::GetStreamAt(FX_DWORD i) const {
+CPDF_Stream* CPDF_Array::GetStreamAt(uint32_t i) const {
return ToStream(GetElementValue(i));
}
-CPDF_Array* CPDF_Array::GetArrayAt(FX_DWORD i) const {
+CPDF_Array* CPDF_Array::GetArrayAt(uint32_t i) const {
return ToArray(GetElementValue(i));
}
-void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) {
- if (i >= (FX_DWORD)m_Objects.GetSize())
+void CPDF_Array::RemoveAt(uint32_t i, int nCount) {
+ if (i >= (uint32_t)m_Objects.GetSize())
return;
if (nCount <= 0 || nCount > m_Objects.GetSize() - i)
@@ -145,12 +145,12 @@ void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) {
m_Objects.RemoveAt(i, nCount);
}
-void CPDF_Array::SetAt(FX_DWORD i,
+void CPDF_Array::SetAt(uint32_t i,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs) {
ASSERT(IsArray());
- ASSERT(i < (FX_DWORD)m_Objects.GetSize());
- if (i >= (FX_DWORD)m_Objects.GetSize())
+ ASSERT(i < (uint32_t)m_Objects.GetSize());
+ if (i >= (uint32_t)m_Objects.GetSize())
return;
if (CPDF_Object* pOld = m_Objects.GetAt(i))
pOld->Release();
@@ -161,7 +161,7 @@ void CPDF_Array::SetAt(FX_DWORD i,
m_Objects.SetAt(i, pObj);
}
-void CPDF_Array::InsertAt(FX_DWORD index,
+void CPDF_Array::InsertAt(uint32_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs) {
if (pObj->GetObjNum()) {
@@ -201,7 +201,7 @@ void CPDF_Array::AddNumber(FX_FLOAT f) {
}
void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum) {
+ uint32_t objnum) {
ASSERT(IsArray());
Add(new CPDF_Reference(pDoc, objnum));
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
index 2c41c13a5a..858133d58e 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
@@ -46,7 +46,7 @@ CPDF_DataAvail::CPDF_DataAvail(IPDF_DataAvail::FileAvail* pFileAvail,
m_Pos = 0;
m_dwFileLen = 0;
if (m_pFileRead) {
- m_dwFileLen = (FX_DWORD)m_pFileRead->GetSize();
+ m_dwFileLen = (uint32_t)m_pFileRead->GetSize();
}
m_dwCurrentOffset = 0;
m_dwXRefOffset = 0;
@@ -107,7 +107,7 @@ void CPDF_DataAvail::SetDocument(CPDF_Document* pDoc) {
m_pDocument = pDoc;
}
-FX_DWORD CPDF_DataAvail::GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset) {
+uint32_t CPDF_DataAvail::GetObjectSize(uint32_t objnum, FX_FILESIZE& offset) {
CPDF_Parser* pParser = m_pDocument->GetParser();
if (!pParser || !pParser->IsValidObjectNumber(objnum))
return 0;
@@ -140,7 +140,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
if (!obj_array.GetSize())
return TRUE;
- FX_DWORD count = 0;
+ uint32_t count = 0;
CFX_ArrayTemplate<CPDF_Object*> new_obj_array;
int32_t i = 0;
for (i = 0; i < obj_array.GetSize(); i++) {
@@ -152,7 +152,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
switch (type) {
case CPDF_Object::ARRAY: {
CPDF_Array* pArray = pObj->GetArray();
- for (FX_DWORD k = 0; k < pArray->GetCount(); ++k)
+ for (uint32_t k = 0; k < pArray->GetCount(); ++k)
new_obj_array.Add(pArray->GetElement(k));
} break;
case CPDF_Object::STREAM:
@@ -171,10 +171,10 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
} break;
case CPDF_Object::REFERENCE: {
CPDF_Reference* pRef = pObj->AsReference();
- FX_DWORD dwNum = pRef->GetRefObjNum();
+ uint32_t dwNum = pRef->GetRefObjNum();
FX_FILESIZE offset;
- FX_DWORD size = GetObjectSize(dwNum, offset);
+ uint32_t size = GetObjectSize(dwNum, offset);
if (size == 0 || offset < 0 || offset >= m_dwFileLen)
break;
@@ -197,7 +197,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
for (i = 0; i < iSize; ++i) {
CPDF_Object* pObj = new_obj_array[i];
if (CPDF_Reference* pRef = pObj->AsReference()) {
- FX_DWORD dwNum = pRef->GetRefObjNum();
+ uint32_t dwNum = pRef->GetRefObjNum();
if (!pdfium::ContainsKey(m_ObjectSet, dwNum))
ret_array.Add(pObj);
} else {
@@ -215,7 +215,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsDocAvail(
IPDF_DataAvail::DownloadHints* pHints) {
if (!m_dwFileLen && m_pFileRead) {
- m_dwFileLen = (FX_DWORD)m_pFileRead->GetSize();
+ m_dwFileLen = (uint32_t)m_pFileRead->GetSize();
if (!m_dwFileLen)
return DataError;
}
@@ -343,17 +343,17 @@ FX_BOOL CPDF_DataAvail::CheckPageStatus(IPDF_DataAvail::DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::LoadAllFile(IPDF_DataAvail::DownloadHints* pHints) {
- if (m_pFileAvail->IsDataAvail(0, (FX_DWORD)m_dwFileLen)) {
+ if (m_pFileAvail->IsDataAvail(0, (uint32_t)m_dwFileLen)) {
m_docStatus = PDF_DATAAVAIL_DONE;
return TRUE;
}
- pHints->AddSegment(0, (FX_DWORD)m_dwFileLen);
+ pHints->AddSegment(0, (uint32_t)m_dwFileLen);
return FALSE;
}
FX_BOOL CPDF_DataAvail::LoadAllXref(IPDF_DataAvail::DownloadHints* pHints) {
- m_parser.m_pSyntax->InitParser(m_pFileRead, (FX_DWORD)m_dwHeaderOffset);
+ m_parser.m_pSyntax->InitParser(m_pFileRead, (uint32_t)m_dwHeaderOffset);
m_parser.m_bOwnFileRead = false;
if (!m_parser.LoadAllCrossRefV4(m_dwLastXRefOffset) &&
!m_parser.LoadAllCrossRefV5(m_dwLastXRefOffset)) {
@@ -368,11 +368,11 @@ FX_BOOL CPDF_DataAvail::LoadAllXref(IPDF_DataAvail::DownloadHints* pHints) {
return TRUE;
}
-CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum,
+CPDF_Object* CPDF_DataAvail::GetObject(uint32_t objnum,
IPDF_DataAvail::DownloadHints* pHints,
FX_BOOL* pExistInFile) {
CPDF_Object* pRet = nullptr;
- FX_DWORD size = 0;
+ uint32_t size = 0;
FX_FILESIZE offset = 0;
CPDF_Parser* pParser = nullptr;
@@ -383,7 +383,7 @@ CPDF_Object* CPDF_DataAvail::GetObject(FX_DWORD objnum,
size = GetObjectSize(objnum, offset);
pParser = m_pDocument->GetParser();
} else {
- size = (FX_DWORD)m_parser.GetObjectSize(objnum);
+ size = (uint32_t)m_parser.GetObjectSize(objnum);
offset = m_parser.GetObjectOffset(objnum);
pParser = &m_parser;
}
@@ -498,10 +498,10 @@ void CPDF_DataAvail::ResetFirstCheck(int iPage) {
}
FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) {
- FX_DWORD iPageObjs = m_PageObjList.GetSize();
- CFX_ArrayTemplate<FX_DWORD> UnavailObjList;
- for (FX_DWORD i = 0; i < iPageObjs; ++i) {
- FX_DWORD dwPageObjNum = m_PageObjList.GetAt(i);
+ uint32_t iPageObjs = m_PageObjList.GetSize();
+ CFX_ArrayTemplate<uint32_t> UnavailObjList;
+ for (uint32_t i = 0; i < iPageObjs; ++i) {
+ uint32_t dwPageObjNum = m_PageObjList.GetAt(i);
FX_BOOL bExist = FALSE;
CPDF_Object* pObj = GetObject(dwPageObjNum, pHints, &bExist);
if (!pObj) {
@@ -540,8 +540,8 @@ FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) {
return FALSE;
}
- FX_DWORD iPages = m_PagesArray.GetSize();
- for (FX_DWORD i = 0; i < iPages; i++) {
+ uint32_t iPages = m_PagesArray.GetSize();
+ for (uint32_t i = 0; i < iPages; i++) {
CPDF_Object* pPages = m_PagesArray.GetAt(i);
if (!pPages)
continue;
@@ -583,7 +583,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
- for (FX_DWORD i = 0; i < pKidsArray->GetCount(); ++i) {
+ for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) {
if (CPDF_Reference* pRef = ToReference(pKidsArray->GetElement(i)))
m_PageObjList.Add(pRef->GetRefObjNum());
}
@@ -623,9 +623,9 @@ FX_BOOL CPDF_DataAvail::CheckPages(IPDF_DataAvail::DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::CheckHeader(IPDF_DataAvail::DownloadHints* pHints) {
- FX_DWORD req_size = 1024;
+ uint32_t req_size = 1024;
if ((FX_FILESIZE)req_size > m_dwFileLen)
- req_size = (FX_DWORD)m_dwFileLen;
+ req_size = (uint32_t)m_dwFileLen;
if (m_pFileAvail->IsDataAvail(0, req_size)) {
uint8_t buffer[1024];
@@ -667,10 +667,10 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) {
FX_BOOL bNeedDownLoad = FALSE;
if (pEndOffSet->IsNumber()) {
- FX_DWORD dwEnd = pEndOffSet->GetInteger();
+ uint32_t dwEnd = pEndOffSet->GetInteger();
dwEnd += 512;
if ((FX_FILESIZE)dwEnd > m_dwFileLen)
- dwEnd = (FX_DWORD)m_dwFileLen;
+ dwEnd = (uint32_t)m_dwFileLen;
int32_t iStartPos = (int32_t)(m_dwFileLen > 1024 ? 1024 : m_dwFileLen);
int32_t iSize = dwEnd > 1024 ? dwEnd - 1024 : 0;
@@ -689,9 +689,9 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) {
dwFileLen = pFileLen->GetInteger();
if (!m_pFileAvail->IsDataAvail(m_dwLastXRefOffset,
- (FX_DWORD)(dwFileLen - m_dwLastXRefOffset))) {
+ (uint32_t)(dwFileLen - m_dwLastXRefOffset))) {
if (m_docStatus == PDF_DATAAVAIL_FIRSTPAGE) {
- FX_DWORD dwSize = (FX_DWORD)(dwFileLen - m_dwLastXRefOffset);
+ uint32_t dwSize = (uint32_t)(dwFileLen - m_dwLastXRefOffset);
FX_FILESIZE offset = m_dwLastXRefOffset;
if (dwSize < 512 && dwFileLen > 512) {
dwSize = 512;
@@ -714,12 +714,12 @@ FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::IsDataAvail(FX_FILESIZE offset,
- FX_DWORD size,
+ uint32_t size,
IPDF_DataAvail::DownloadHints* pHints) {
if (offset > m_dwFileLen)
return TRUE;
- FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<FX_DWORD>(offset);
+ FX_SAFE_DWORD safeSize = pdfium::base::checked_cast<uint32_t>(offset);
safeSize += size;
safeSize += 512;
if (!safeSize.IsValid() || safeSize.ValueOrDie() > m_dwFileLen)
@@ -785,7 +785,7 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IPDF_DataAvail::DownloadHints* pHints) {
CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
CPDF_IndirectObjectHolder* pObjList) {
FX_FILESIZE SavedPos = m_syntaxParser.SavePos();
m_syntaxParser.RestorePos(pos);
@@ -795,7 +795,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
if (!bIsNumber)
return nullptr;
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (objnum && parser_objnum != objnum)
return nullptr;
@@ -803,7 +803,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
if (!bIsNumber)
return nullptr;
- FX_DWORD gennum = FXSYS_atoui(word);
+ uint32_t gennum = FXSYS_atoui(word);
if (m_syntaxParser.GetKeyword() != "obj") {
m_syntaxParser.RestorePos(SavedPos);
return nullptr;
@@ -816,7 +816,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
}
IPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() {
- FX_DWORD req_size = 1024;
+ uint32_t req_size = 1024;
if (!m_pFileAvail->IsDataAvail(0, req_size))
return LinearizationUnknown;
@@ -834,7 +834,7 @@ IPDF_DataAvail::DocLinearizationStatus CPDF_DataAvail::IsLinearizedPDF() {
return NotLinearized;
}
-FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
+FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
ScopedFileStream file(FX_CreateMemoryStream(pData, (size_t)dwLen, FALSE));
int32_t offset = GetHeaderOffset(file.get());
@@ -852,7 +852,7 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
if (!bNumber)
return FALSE;
- FX_DWORD objnum = FXSYS_atoui(wordObjNum);
+ uint32_t objnum = FXSYS_atoui(wordObjNum);
if (m_pLinearized) {
m_pLinearized->Release();
m_pLinearized = nullptr;
@@ -883,8 +883,8 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
}
FX_BOOL CPDF_DataAvail::CheckEnd(IPDF_DataAvail::DownloadHints* pHints) {
- FX_DWORD req_pos = (FX_DWORD)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
- FX_DWORD dwSize = (FX_DWORD)(m_dwFileLen - req_pos);
+ uint32_t req_pos = (uint32_t)(m_dwFileLen > 1024 ? m_dwFileLen - 1024 : 0);
+ uint32_t dwSize = (uint32_t)(m_dwFileLen - req_pos);
if (m_pFileAvail->IsDataAvail(req_pos, dwSize)) {
uint8_t buffer[1024];
@@ -928,8 +928,8 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(
IPDF_DataAvail::DownloadHints* pHints,
FX_FILESIZE& xref_offset) {
xref_offset = 0;
- FX_DWORD req_size =
- (FX_DWORD)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
+ uint32_t req_size =
+ (uint32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
if (m_pFileAvail->IsDataAvail(m_Pos, req_size)) {
int32_t iSize = (int32_t)(m_Pos + req_size - m_dwCurrentXRefSteam);
@@ -946,7 +946,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(
if (!bNumber)
return -1;
- FX_DWORD objNum = FXSYS_atoui(objnum);
+ uint32_t objNum = FXSYS_atoui(objnum);
CPDF_Object* pObj = m_parser.ParseIndirectObjectAt(nullptr, 0, objNum);
if (!pObj) {
m_Pos += m_parser.m_pSyntax->SavePos();
@@ -997,7 +997,7 @@ FX_BOOL CPDF_DataAvail::GetNextToken(CFX_ByteString& token) {
}
uint8_t buffer[256];
- FX_DWORD index = 0;
+ uint32_t index = 0;
if (PDFCharIsDelimiter(ch)) {
buffer[index++] = ch;
if (ch == '/') {
@@ -1063,9 +1063,9 @@ FX_BOOL CPDF_DataAvail::GetNextChar(uint8_t& ch) {
if (m_bufferOffset >= pos ||
(FX_FILESIZE)(m_bufferOffset + m_bufferSize) <= pos) {
FX_FILESIZE read_pos = pos;
- FX_DWORD read_size = 512;
+ uint32_t read_size = 512;
if ((FX_FILESIZE)read_size > m_dwFileLen)
- read_size = (FX_DWORD)m_dwFileLen;
+ read_size = (uint32_t)m_dwFileLen;
if ((FX_FILESIZE)(read_pos + read_size) > m_dwFileLen)
read_pos = m_dwFileLen - read_size;
@@ -1210,7 +1210,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IPDF_DataAvail::DownloadHints* pHints) {
return TRUE;
}
- FX_DWORD xrefpos = GetDirectInteger(pTrailerDict, "Prev");
+ uint32_t xrefpos = GetDirectInteger(pTrailerDict, "Prev");
if (xrefpos) {
m_dwPrevXRefOffset = GetDirectInteger(pTrailerDict, "XRefStm");
if (m_dwPrevXRefOffset) {
@@ -1259,7 +1259,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage,
}
FX_BOOL CPDF_DataAvail::CheckArrayPageNode(
- FX_DWORD dwPageNo,
+ uint32_t dwPageNo,
CPDF_DataAvail::PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints) {
FX_BOOL bExist = FALSE;
@@ -1285,7 +1285,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(
}
pPageNode->m_type = PDF_PAGENODE_PAGES;
- for (FX_DWORD i = 0; i < pArray->GetCount(); ++i) {
+ for (uint32_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Reference* pKid = ToReference(pArray->GetElement(i));
if (!pKid)
continue;
@@ -1299,7 +1299,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(
}
FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(
- FX_DWORD dwPageNo,
+ uint32_t dwPageNo,
CPDF_DataAvail::PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints) {
FX_BOOL bExist = FALSE;
@@ -1348,7 +1348,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(
} break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
- for (FX_DWORD i = 0; i < pKidsArray->GetCount(); ++i) {
+ for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) {
CPDF_Reference* pKid = ToReference(pKidsArray->GetElement(i));
if (!pKid)
continue;
@@ -1623,7 +1623,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_DataAvail::IsPageAvail(
return DataAvailable;
if (m_bLinearized) {
- if ((FX_DWORD)iPage == m_dwFirstPageNo) {
+ if ((uint32_t)iPage == m_dwFirstPageNo) {
DocAvailStatus nRet = CheckLinearizedFirstPage(iPage, pHints);
if (nRet == DataAvailable)
m_pagesLoadState.insert(iPage);
@@ -1753,11 +1753,11 @@ FX_BOOL CPDF_DataAvail::CheckResources(IPDF_DataAvail::DownloadHints* pHints) {
}
void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos,
- FX_DWORD* pSize) {
+ uint32_t* pSize) {
if (pPos)
*pPos = m_dwLastXRefOffset;
if (pSize)
- *pSize = (FX_DWORD)(m_dwFileLen - m_dwLastXRefOffset);
+ *pSize = (uint32_t)(m_dwFileLen - m_dwLastXRefOffset);
}
int CPDF_DataAvail::GetPageCount() const {
@@ -1781,13 +1781,13 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) {
if (m_pHintTables && index != pageNum) {
FX_FILESIZE szPageStartPos = 0;
FX_FILESIZE szPageLength = 0;
- FX_DWORD dwObjNum = 0;
+ uint32_t dwObjNum = 0;
FX_BOOL bPagePosGot = m_pHintTables->GetPagePos(index, szPageStartPos,
szPageLength, dwObjNum);
if (!bPagePosGot)
return nullptr;
- m_syntaxParser.InitParser(m_pFileRead, (FX_DWORD)szPageStartPos);
+ m_syntaxParser.InitParser(m_pFileRead, (uint32_t)szPageStartPos);
CPDF_Object* pPageDict = ParseIndirectObjectAt(0, dwObjNum, m_pDocument);
if (!pPageDict)
return nullptr;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h
index 036de72968..f7da8f0d22 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h
@@ -63,7 +63,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
DocFormStatus IsFormAvail(DownloadHints* pHints) override;
DocLinearizationStatus IsLinearizedPDF() override;
FX_BOOL IsLinearized() override { return m_bLinearized; }
- void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, FX_DWORD* pSize) override;
+ void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize) override;
int GetPageCount() const;
CPDF_Dictionary* GetPage(int index);
@@ -77,7 +77,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
~PageNode();
PDF_PAGENODE_TYPE m_type;
- FX_DWORD m_dwPageNo;
+ uint32_t m_dwPageNo;
CFX_ArrayTemplate<PageNode*> m_childNode;
};
@@ -85,7 +85,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
static int s_CurrentDataAvailRecursionDepth;
static const int kMaxPageRecursionDepth = 1024;
- FX_DWORD GetObjectSize(FX_DWORD objnum, FX_FILESIZE& offset);
+ uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset);
FX_BOOL IsObjectsAvail(CFX_ArrayTemplate<CPDF_Object*>& obj_array,
FX_BOOL bParsePage,
IPDF_DataAvail::DownloadHints* pHints,
@@ -112,15 +112,15 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
int32_t CheckCrossRefStream(IPDF_DataAvail::DownloadHints* pHints,
FX_FILESIZE& xref_offset);
- FX_BOOL IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen);
+ FX_BOOL IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
FX_BOOL GetNextToken(CFX_ByteString& token);
FX_BOOL GetNextChar(uint8_t& ch);
CPDF_Object* ParseIndirectObjectAt(
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
CPDF_IndirectObjectHolder* pObjList = nullptr);
- CPDF_Object* GetObject(FX_DWORD objnum,
+ CPDF_Object* GetObject(uint32_t objnum,
IPDF_DataAvail::DownloadHints* pHints,
FX_BOOL* pExistInFile);
FX_BOOL GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages);
@@ -143,24 +143,24 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
int32_t& iCount,
IPDF_DataAvail::DownloadHints* pHints,
int level);
- FX_BOOL CheckUnkownPageNode(FX_DWORD dwPageNo,
+ FX_BOOL CheckUnkownPageNode(uint32_t dwPageNo,
PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints);
- FX_BOOL CheckArrayPageNode(FX_DWORD dwPageNo,
+ FX_BOOL CheckArrayPageNode(uint32_t dwPageNo,
PageNode* pPageNode,
IPDF_DataAvail::DownloadHints* pHints);
FX_BOOL CheckPageCount(IPDF_DataAvail::DownloadHints* pHints);
bool IsFirstCheck(int iPage);
void ResetFirstCheck(int iPage);
FX_BOOL IsDataAvail(FX_FILESIZE offset,
- FX_DWORD size,
+ uint32_t size,
IPDF_DataAvail::DownloadHints* pHints);
CPDF_Parser m_parser;
CPDF_SyntaxParser m_syntaxParser;
CPDF_Object* m_pRoot;
- FX_DWORD m_dwRootObjNum;
- FX_DWORD m_dwInfoObjNum;
+ uint32_t m_dwRootObjNum;
+ uint32_t m_dwInfoObjNum;
CPDF_Object* m_pLinearized;
CPDF_Object* m_pTrailer;
FX_BOOL m_bDocAvail;
@@ -172,18 +172,18 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
PDF_DATAAVAIL_STATUS m_docStatus;
FX_FILESIZE m_dwFileLen;
CPDF_Document* m_pDocument;
- std::set<FX_DWORD> m_ObjectSet;
+ std::set<uint32_t> m_ObjectSet;
CFX_ArrayTemplate<CPDF_Object*> m_objs_array;
FX_FILESIZE m_Pos;
FX_FILESIZE m_bufferOffset;
- FX_DWORD m_bufferSize;
+ uint32_t m_bufferSize;
CFX_ByteString m_WordBuf;
uint8_t m_bufferData[512];
- CFX_ArrayTemplate<FX_DWORD> m_XRefStreamList;
- CFX_ArrayTemplate<FX_DWORD> m_PageObjList;
- FX_DWORD m_PagesObjNum;
+ CFX_ArrayTemplate<uint32_t> m_XRefStreamList;
+ CFX_ArrayTemplate<uint32_t> m_PageObjList;
+ uint32_t m_PagesObjNum;
FX_BOOL m_bLinearized;
- FX_DWORD m_dwFirstPageNo;
+ uint32_t m_dwFirstPageNo;
FX_BOOL m_bLinearedDataOK;
FX_BOOL m_bMainXRefLoadTried;
FX_BOOL m_bMainXRefLoadedOK;
@@ -193,7 +193,7 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
FX_FILESIZE m_dwCurrentXRefSteam;
FX_BOOL m_bAnnotsLoad;
FX_BOOL m_bHaveAcroForm;
- FX_DWORD m_dwAcroFormObjNum;
+ uint32_t m_dwAcroFormObjNum;
FX_BOOL m_bAcroFormLoad;
CPDF_Object* m_pAcroForm;
CFX_ArrayTemplate<CPDF_Object*> m_arrayAcroforms;
@@ -203,13 +203,13 @@ class CPDF_DataAvail final : public IPDF_DataAvail {
FX_BOOL m_bPageLoadedOK;
FX_BOOL m_bLinearizedFormParamLoad;
CFX_ArrayTemplate<CPDF_Object*> m_PagesArray;
- FX_DWORD m_dwEncryptObjNum;
+ uint32_t m_dwEncryptObjNum;
FX_FILESIZE m_dwPrevXRefOffset;
FX_BOOL m_bTotalLoadPageTree;
FX_BOOL m_bCurPageDictLoadOK;
PageNode m_pageNodes;
- std::set<FX_DWORD> m_pageMapCheckState;
- std::set<FX_DWORD> m_pagesLoadState;
+ std::set<uint32_t> m_pageMapCheckState;
+ std::set<uint32_t> m_pagesLoadState;
std::unique_ptr<CPDF_HintTables> m_pHintTables;
FX_BOOL m_bSupportHintTable;
};
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
index 0155c43bb8..75730e5754 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
@@ -229,13 +229,13 @@ void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key,
void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum) {
+ uint32_t objnum) {
SetAt(key, new CPDF_Reference(pDoc, objnum));
}
void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum) {
+ uint32_t objnum) {
SetAt(key, new CPDF_Reference(pDoc, objnum));
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index eb9a483e6e..9ed8b3fac6 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -32,7 +32,7 @@ int CountPages(CPDF_Dictionary* pPages,
return 0;
}
count = 0;
- for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
+ for (uint32_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) {
continue;
@@ -114,7 +114,7 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_ID1 = pIDArray->GetStringAt(0);
m_ID2 = pIDArray->GetStringAt(1);
}
- FX_DWORD dwPageCount = 0;
+ uint32_t dwPageCount = 0;
CPDF_Object* pCount = pLinearized->GetElement("N");
if (ToNumber(pCount))
dwPageCount = pCount->GetInteger();
@@ -216,8 +216,8 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
}
int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
- FX_DWORD& skip_count,
- FX_DWORD objnum,
+ uint32_t& skip_count,
+ uint32_t objnum,
int& index,
int level) {
if (pNode->KeyExist("Kids")) {
@@ -228,14 +228,14 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
if (level >= FX_MAX_PAGE_LEVEL) {
return -1;
}
- FX_DWORD count = pNode->GetIntegerBy("Count");
+ uint32_t count = pNode->GetIntegerBy("Count");
if (count <= skip_count) {
skip_count -= count;
index += count;
return -1;
}
if (count && count == pKidList->GetCount()) {
- for (FX_DWORD i = 0; i < count; i++) {
+ for (uint32_t i = 0; i < count; i++) {
if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) {
if (pKid->GetRefObjNum() == objnum) {
m_PageList.SetAt(index + i, objnum);
@@ -244,7 +244,7 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
}
}
}
- for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) {
+ for (uint32_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid) {
continue;
@@ -269,12 +269,12 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
}
return -1;
}
-int CPDF_Document::GetPageIndex(FX_DWORD objnum) {
- FX_DWORD nPages = m_PageList.GetSize();
- FX_DWORD skip_count = 0;
+int CPDF_Document::GetPageIndex(uint32_t objnum) {
+ uint32_t nPages = m_PageList.GetSize();
+ uint32_t skip_count = 0;
FX_BOOL bSkipped = FALSE;
- for (FX_DWORD i = 0; i < nPages; i++) {
- FX_DWORD objnum1 = m_PageList.GetAt(i);
+ for (uint32_t i = 0; i < nPages; i++) {
+ uint32_t objnum1 = m_PageList.GetAt(i);
if (objnum1 == objnum) {
return i;
}
@@ -315,14 +315,14 @@ int CPDF_Document::RetrievePageCount() const {
return CountPages(pPages, &visited_pages);
}
-FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
+uint32_t CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const {
if (!m_pParser) {
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
}
return m_pParser->GetPermissions(bCheckRevision);
}
-FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
+FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const {
auto it = m_IndirectObjs.find(objnum);
if (it != m_IndirectObjs.end()) {
CPDF_Stream* pStream = it->second->AsStream();
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
index eafda43965..dd2be01311 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp
@@ -30,7 +30,7 @@ CPDF_HintTables::~CPDF_HintTables() {
m_dwIdentifierArray.RemoveAll();
}
-FX_DWORD CPDF_HintTables::GetItemLength(
+uint32_t CPDF_HintTables::GetItemLength(
int index,
const std::vector<FX_FILESIZE>& szArray) {
if (index < 0 || szArray.size() < 2 ||
@@ -50,17 +50,17 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
if (nStreamOffset < 0 || nStreamLen < 1)
return FALSE;
- const FX_DWORD kHeaderSize = 288;
+ const uint32_t kHeaderSize = 288;
if (hStream->BitsRemaining() < kHeaderSize)
return FALSE;
// Item 1: The least number of objects in a page.
- FX_DWORD dwObjLeastNum = hStream->GetBits(32);
+ uint32_t dwObjLeastNum = hStream->GetBits(32);
// Item 2: The location of the first page's page object.
- FX_DWORD dwFirstObjLoc = hStream->GetBits(32);
+ uint32_t dwFirstObjLoc = hStream->GetBits(32);
if (dwFirstObjLoc > nStreamOffset) {
- FX_SAFE_DWORD safeLoc = pdfium::base::checked_cast<FX_DWORD>(nStreamLen);
+ FX_SAFE_DWORD safeLoc = pdfium::base::checked_cast<uint32_t>(nStreamLen);
safeLoc += dwFirstObjLoc;
if (!safeLoc.IsValid())
return FALSE;
@@ -73,31 +73,31 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
// Item 3: The number of bits needed to represent the difference
// between the greatest and least number of objects in a page.
- FX_DWORD dwDeltaObjectsBits = hStream->GetBits(16);
+ uint32_t dwDeltaObjectsBits = hStream->GetBits(16);
// Item 4: The least length of a page in bytes.
- FX_DWORD dwPageLeastLen = hStream->GetBits(32);
+ uint32_t dwPageLeastLen = hStream->GetBits(32);
// Item 5: The number of bits needed to represent the difference
// between the greatest and least length of a page, in bytes.
- FX_DWORD dwDeltaPageLenBits = hStream->GetBits(16);
+ uint32_t dwDeltaPageLenBits = hStream->GetBits(16);
// Skip Item 6, 7, 8, 9 total 96 bits.
hStream->SkipBits(96);
// Item 10: The number of bits needed to represent the greatest
// number of shared object references.
- FX_DWORD dwSharedObjBits = hStream->GetBits(16);
+ uint32_t dwSharedObjBits = hStream->GetBits(16);
// Item 11: The number of bits needed to represent the numerically
// greatest shared object identifier used by the pages.
- FX_DWORD dwSharedIdBits = hStream->GetBits(16);
+ uint32_t dwSharedIdBits = hStream->GetBits(16);
// Item 12: The number of bits needed to represent the numerator of
// the fractional position for each shared object reference. For each
// shared object referenced from a page, there is an indication of
// where in the page's content stream the object is first referenced.
- FX_DWORD dwSharedNumeratorBits = hStream->GetBits(16);
+ uint32_t dwSharedNumeratorBits = hStream->GetBits(16);
// Item 13: Skip Item 13 which has 16 bits.
hStream->SkipBits(16);
@@ -108,7 +108,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
return FALSE;
FX_SAFE_DWORD required_bits = dwDeltaObjectsBits;
- required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages);
+ required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
@@ -122,11 +122,11 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
hStream->ByteAlign();
required_bits = dwDeltaPageLenBits;
- required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages);
+ required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
- CFX_ArrayTemplate<FX_DWORD> dwPageLenArray;
+ CFX_ArrayTemplate<uint32_t> dwPageLenArray;
for (int i = 0; i < nPages; ++i) {
FX_SAFE_DWORD safePageLen = hStream->GetBits(dwDeltaPageLenBits);
safePageLen += dwPageLeastLen;
@@ -170,7 +170,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
// Number of shared objects.
required_bits = dwSharedObjBits;
- required_bits *= pdfium::base::checked_cast<FX_DWORD>(nPages);
+ required_bits *= pdfium::base::checked_cast<uint32_t>(nPages);
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
@@ -200,7 +200,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
}
hStream->ByteAlign();
- FX_SAFE_DWORD safeTotalPageLen = pdfium::base::checked_cast<FX_DWORD>(nPages);
+ FX_SAFE_DWORD safeTotalPageLen = pdfium::base::checked_cast<uint32_t>(nPages);
safeTotalPageLen *= dwDeltaPageLenBits;
if (!CanReadFromBitStream(hStream, safeTotalPageLen))
return FALSE;
@@ -211,7 +211,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
}
FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
- FX_DWORD offset) {
+ uint32_t offset) {
if (!hStream || hStream->IsEOF())
return FALSE;
@@ -226,16 +226,16 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
return FALSE;
hStream->SkipBits(bit_offset.ValueOrDie() - hStream->GetPos());
- const FX_DWORD kHeaderSize = 192;
+ const uint32_t kHeaderSize = 192;
if (hStream->BitsRemaining() < kHeaderSize)
return FALSE;
// Item 1: The object number of the first object in the shared objects
// section.
- FX_DWORD dwFirstSharedObjNum = hStream->GetBits(32);
+ uint32_t dwFirstSharedObjNum = hStream->GetBits(32);
// Item 2: The location of the first object in the shared objects section.
- FX_DWORD dwFirstSharedObjLoc = hStream->GetBits(32);
+ uint32_t dwFirstSharedObjLoc = hStream->GetBits(32);
if (dwFirstSharedObjLoc > nStreamOffset)
dwFirstSharedObjLoc += nStreamLen;
@@ -244,31 +244,31 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
// Item 4: The number of shared object entries for the shared objects
// section, including the number of shared object entries for the first page.
- FX_DWORD dwSharedObjTotal = hStream->GetBits(32);
+ uint32_t dwSharedObjTotal = hStream->GetBits(32);
// Item 5: The number of bits needed to represent the greatest number of
// objects in a shared object group. Skipped.
hStream->SkipBits(16);
// Item 6: The least length of a shared object group in bytes.
- FX_DWORD dwGroupLeastLen = hStream->GetBits(32);
+ uint32_t dwGroupLeastLen = hStream->GetBits(32);
// Item 7: The number of bits needed to represent the difference between the
// greatest and least length of a shared object group, in bytes.
- FX_DWORD dwDeltaGroupLen = hStream->GetBits(16);
+ uint32_t dwDeltaGroupLen = hStream->GetBits(16);
CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O");
int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1;
if (nFirstPageObjNum < 0)
return FALSE;
- FX_DWORD dwPrevObjLen = 0;
- FX_DWORD dwCurObjLen = 0;
+ uint32_t dwPrevObjLen = 0;
+ uint32_t dwCurObjLen = 0;
FX_SAFE_DWORD required_bits = dwSharedObjTotal;
required_bits *= dwDeltaGroupLen;
if (!CanReadFromBitStream(hStream, required_bits))
return FALSE;
- for (FX_DWORD i = 0; i < dwSharedObjTotal; ++i) {
+ for (uint32_t i = 0; i < dwSharedObjTotal; ++i) {
dwPrevObjLen = dwCurObjLen;
FX_SAFE_DWORD safeObjLen = hStream->GetBits(dwDeltaGroupLen);
safeObjLen += dwGroupLeastLen;
@@ -324,7 +324,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
FX_BOOL CPDF_HintTables::GetPagePos(int index,
FX_FILESIZE& szPageStartPos,
FX_FILESIZE& szPageLength,
- FX_DWORD& dwObjNum) {
+ uint32_t& dwObjNum) {
if (!m_pLinearizedDict)
return FALSE;
@@ -365,7 +365,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage(
if (index == nFirstAvailPage)
return IPDF_DataAvail::DataAvailable;
- FX_DWORD dwLength = GetItemLength(index, m_szPageOffsetArray);
+ uint32_t dwLength = GetItemLength(index, m_szPageOffsetArray);
// If two pages have the same offset, it should be treated as an error.
if (!dwLength)
return IPDF_DataAvail::DataError;
@@ -374,7 +374,7 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage(
return IPDF_DataAvail::DataNotAvailable;
// Download data of shared objects in the page.
- FX_DWORD offset = 0;
+ uint32_t offset = 0;
for (int i = 0; i < index; ++i)
offset += m_dwNSharedObjsArray[i];
@@ -383,8 +383,8 @@ IPDF_DataAvail::DocAvailStatus CPDF_HintTables::CheckPage(
if (nFirstPageObjNum < 0)
return IPDF_DataAvail::DataError;
- FX_DWORD dwIndex = 0;
- FX_DWORD dwObjNum = 0;
+ uint32_t dwIndex = 0;
+ uint32_t dwObjNum = 0;
for (int j = 0; j < m_dwNSharedObjsArray[index]; ++j) {
dwIndex = m_dwIdentifierArray[offset + j];
if (dwIndex >= m_dwSharedObjNumArray.GetSize())
@@ -422,11 +422,11 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
CPDF_StreamAcc acc;
acc.LoadAllData(pHintStream);
- FX_DWORD size = acc.GetSize();
+ uint32_t size = acc.GetSize();
// The header section of page offset hint table is 36 bytes.
// The header section of shared object hint table is 24 bytes.
// Hint table has at least 60 bytes.
- const FX_DWORD MIN_STREAM_LEN = 60;
+ const uint32_t MIN_STREAM_LEN = 60;
if (size < MIN_STREAM_LEN || shared_hint_table_offset <= 0 ||
size < shared_hint_table_offset) {
return FALSE;
@@ -435,7 +435,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
CFX_BitStream bs;
bs.Init(acc.GetData(), size);
return ReadPageHintTable(&bs) &&
- ReadSharedObjHintTable(&bs, pdfium::base::checked_cast<FX_DWORD>(
+ ReadSharedObjHintTable(&bs, pdfium::base::checked_cast<uint32_t>(
shared_hint_table_offset));
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h
index f6f862fab6..28ccccb6fc 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h
@@ -30,7 +30,7 @@ class CPDF_HintTables {
FX_BOOL GetPagePos(int index,
FX_FILESIZE& szPageStartPos,
FX_FILESIZE& szPageLength,
- FX_DWORD& dwObjNum);
+ uint32_t& dwObjNum);
IPDF_DataAvail::DocAvailStatus CheckPage(
int index,
@@ -40,8 +40,8 @@ class CPDF_HintTables {
protected:
FX_BOOL ReadPageHintTable(CFX_BitStream* hStream);
- FX_BOOL ReadSharedObjHintTable(CFX_BitStream* hStream, FX_DWORD offset);
- FX_DWORD GetItemLength(int index, const std::vector<FX_FILESIZE>& szArray);
+ FX_BOOL ReadSharedObjHintTable(CFX_BitStream* hStream, uint32_t offset);
+ uint32_t GetItemLength(int index, const std::vector<FX_FILESIZE>& szArray);
private:
int ReadPrimaryHintStreamOffset() const;
@@ -49,12 +49,12 @@ class CPDF_HintTables {
CPDF_Dictionary* m_pLinearizedDict;
CPDF_DataAvail* m_pDataAvail;
- FX_DWORD m_nFirstPageSharedObjs;
+ uint32_t m_nFirstPageSharedObjs;
FX_FILESIZE m_szFirstPageObjOffset;
- CFX_ArrayTemplate<FX_DWORD> m_dwDeltaNObjsArray;
- CFX_ArrayTemplate<FX_DWORD> m_dwNSharedObjsArray;
- CFX_ArrayTemplate<FX_DWORD> m_dwSharedObjNumArray;
- CFX_ArrayTemplate<FX_DWORD> m_dwIdentifierArray;
+ CFX_ArrayTemplate<uint32_t> m_dwDeltaNObjsArray;
+ CFX_ArrayTemplate<uint32_t> m_dwNSharedObjsArray;
+ CFX_ArrayTemplate<uint32_t> m_dwSharedObjNumArray;
+ CFX_ArrayTemplate<uint32_t> m_dwIdentifierArray;
std::vector<FX_FILESIZE> m_szPageOffsetArray;
std::vector<FX_FILESIZE> m_szSharedObjOffsetArray;
};
diff --git a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp
index 1de1ef2252..14410dabb5 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp
@@ -20,7 +20,7 @@ CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() {
pair.second->Destroy();
}
-CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(FX_DWORD objnum) {
+CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(uint32_t objnum) {
if (objnum == 0)
return nullptr;
@@ -44,7 +44,7 @@ CPDF_Object* CPDF_IndirectObjectHolder::GetIndirectObject(FX_DWORD objnum) {
return pObj;
}
-FX_DWORD CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) {
+uint32_t CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) {
if (pObj->m_ObjNum)
return pObj->m_ObjNum;
@@ -54,7 +54,7 @@ FX_DWORD CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) {
return m_LastObjNum;
}
-void CPDF_IndirectObjectHolder::ReleaseIndirectObject(FX_DWORD objnum) {
+void CPDF_IndirectObjectHolder::ReleaseIndirectObject(uint32_t objnum) {
auto it = m_IndirectObjs.find(objnum);
if (it == m_IndirectObjs.end() || it->second->GetObjNum() == -1)
return;
@@ -62,7 +62,7 @@ void CPDF_IndirectObjectHolder::ReleaseIndirectObject(FX_DWORD objnum) {
m_IndirectObjs.erase(it);
}
-FX_BOOL CPDF_IndirectObjectHolder::InsertIndirectObject(FX_DWORD objnum,
+FX_BOOL CPDF_IndirectObjectHolder::InsertIndirectObject(uint32_t objnum,
CPDF_Object* pObj) {
if (!objnum || !pObj)
return FALSE;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
index 5312e62d43..bebd3d62be 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -31,10 +31,10 @@ const int32_t kMaxXRefSize = 1048576;
// A limit on the maximum object number in the xref table. Theoretical limits
// are higher, but this may be large enough in practice.
-const FX_DWORD kMaxObjectNumber = 1048576;
+const uint32_t kMaxObjectNumber = 1048576;
-FX_DWORD GetVarInt(const uint8_t* p, int32_t n) {
- FX_DWORD result = 0;
+uint32_t GetVarInt(const uint8_t* p, int32_t n) {
+ uint32_t result = 0;
for (int32_t i = 0; i < n; ++i)
result = result * 256 + p[i];
return result;
@@ -67,32 +67,32 @@ CPDF_Parser::~CPDF_Parser() {
CloseParser();
}
-FX_DWORD CPDF_Parser::GetLastObjNum() const {
+uint32_t CPDF_Parser::GetLastObjNum() const {
return m_ObjectInfo.empty() ? 0 : m_ObjectInfo.rbegin()->first;
}
-bool CPDF_Parser::IsValidObjectNumber(FX_DWORD objnum) const {
+bool CPDF_Parser::IsValidObjectNumber(uint32_t objnum) const {
return !m_ObjectInfo.empty() && objnum <= m_ObjectInfo.rbegin()->first;
}
-FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero(FX_DWORD objnum) const {
+FX_FILESIZE CPDF_Parser::GetObjectPositionOrZero(uint32_t objnum) const {
auto it = m_ObjectInfo.find(objnum);
return it != m_ObjectInfo.end() ? it->second.pos : 0;
}
-uint8_t CPDF_Parser::GetObjectType(FX_DWORD objnum) const {
+uint8_t CPDF_Parser::GetObjectType(uint32_t objnum) const {
ASSERT(IsValidObjectNumber(objnum));
auto it = m_ObjectInfo.find(objnum);
return it != m_ObjectInfo.end() ? it->second.type : 0;
}
-uint16_t CPDF_Parser::GetObjectGenNum(FX_DWORD objnum) const {
+uint16_t CPDF_Parser::GetObjectGenNum(uint32_t objnum) const {
ASSERT(IsValidObjectNumber(objnum));
auto it = m_ObjectInfo.find(objnum);
return it != m_ObjectInfo.end() ? it->second.gennum : 0;
}
-bool CPDF_Parser::IsObjectFreeOrNull(FX_DWORD objnum) const {
+bool CPDF_Parser::IsObjectFreeOrNull(uint32_t objnum) const {
uint8_t type = GetObjectType(objnum);
return type == 0 || type == 255;
}
@@ -109,7 +109,7 @@ IFX_FileRead* CPDF_Parser::GetFileAccess() const {
return m_pSyntax->m_pFileAccess;
}
-void CPDF_Parser::ShrinkObjectMap(FX_DWORD objnum) {
+void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) {
if (objnum == 0) {
m_ObjectInfo.clear();
return;
@@ -302,7 +302,7 @@ void CPDF_Parser::ReleaseEncryptHandler() {
m_pSecurityHandler.reset();
}
-FX_FILESIZE CPDF_Parser::GetObjectOffset(FX_DWORD objnum) const {
+FX_FILESIZE CPDF_Parser::GetObjectOffset(uint32_t objnum) const {
if (!IsValidObjectNumber(objnum))
return 0;
@@ -371,7 +371,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
}
FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
- FX_DWORD dwObjCount) {
+ uint32_t dwObjCount) {
if (!LoadLinearizedCrossRefV4(xrefpos, dwObjCount))
return FALSE;
@@ -424,14 +424,14 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
}
FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
- FX_DWORD dwObjCount) {
+ uint32_t dwObjCount) {
FX_FILESIZE dwStartPos = pos - m_pSyntax->m_HeaderOffset;
m_pSyntax->RestorePos(dwStartPos);
m_SortedOffset.insert(pos);
- FX_DWORD start_objnum = 0;
- FX_DWORD count = dwObjCount;
+ uint32_t start_objnum = 0;
+ uint32_t count = dwObjCount;
FX_FILESIZE SavedPos = m_pSyntax->SavePos();
const int32_t recordsize = 20;
@@ -441,7 +441,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
int32_t nBlocks = count / 1024 + 1;
for (int32_t block = 0; block < nBlocks; block++) {
int32_t block_size = block == nBlocks - 1 ? count % 1024 : 1024;
- FX_DWORD dwReadSize = block_size * recordsize;
+ uint32_t dwReadSize = block_size * recordsize;
if ((FX_FILESIZE)(dwStartPos + dwReadSize) > m_pSyntax->m_FileLen)
return FALSE;
@@ -451,7 +451,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedCrossRefV4(FX_FILESIZE pos,
}
for (int32_t i = 0; i < block_size; i++) {
- FX_DWORD objnum = start_objnum + block * 1024 + i;
+ uint32_t objnum = start_objnum + block * 1024 + i;
char* pEntry = &buf[i * recordsize];
if (pEntry[17] == 'f') {
m_ObjectInfo[objnum].pos = 0;
@@ -505,11 +505,11 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
break;
}
- FX_DWORD start_objnum = FXSYS_atoui(word);
+ uint32_t start_objnum = FXSYS_atoui(word);
if (start_objnum >= kMaxObjectNumber)
return false;
- FX_DWORD count = m_pSyntax->GetDirectNum();
+ uint32_t count = m_pSyntax->GetDirectNum();
m_pSyntax->ToNextWord();
SavedPos = m_pSyntax->SavePos();
const int32_t recordsize = 20;
@@ -526,7 +526,7 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
block_size * recordsize);
for (int32_t i = 0; i < block_size; i++) {
- FX_DWORD objnum = start_objnum + block * 1024 + i;
+ uint32_t objnum = start_objnum + block * 1024 + i;
char* pEntry = &buf[i * recordsize];
if (pEntry[17] == 'f') {
m_ObjectInfo[objnum].pos = 0;
@@ -589,11 +589,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
ParserState state = ParserState::kDefault;
int32_t inside_index = 0;
- FX_DWORD objnum = 0;
- FX_DWORD gennum = 0;
+ uint32_t objnum = 0;
+ uint32_t gennum = 0;
int32_t depth = 0;
- const FX_DWORD kBufferSize = 4096;
+ const uint32_t kBufferSize = 4096;
std::vector<uint8_t> buffer(kBufferSize);
FX_FILESIZE pos = m_pSyntax->m_HeaderOffset;
@@ -606,12 +606,12 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
while (pos < m_pSyntax->m_FileLen) {
const FX_FILESIZE saved_pos = pos;
bool bOverFlow = false;
- FX_DWORD size =
- std::min((FX_DWORD)(m_pSyntax->m_FileLen - pos), kBufferSize);
+ uint32_t size =
+ std::min((uint32_t)(m_pSyntax->m_FileLen - pos), kBufferSize);
if (!m_pSyntax->m_pFileAccess->ReadBlock(buffer.data(), pos, size))
break;
- for (FX_DWORD i = 0; i < size; i++) {
+ for (uint32_t i = 0; i < size; i++) {
uint8_t byte = buffer[i];
switch (state) {
case ParserState::kDefault:
@@ -763,17 +763,17 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
offset += 3;
FX_FILESIZE nLen = obj_end - obj_pos - offset;
- if ((FX_DWORD)nLen > size - i) {
+ if ((uint32_t)nLen > size - i) {
pos = obj_end + m_pSyntax->m_HeaderOffset;
bOverFlow = true;
} else {
- i += (FX_DWORD)nLen;
+ i += (uint32_t)nLen;
}
if (!m_ObjectInfo.empty() && IsValidObjectNumber(objnum) &&
m_ObjectInfo[objnum].pos) {
if (pObject) {
- FX_DWORD oldgen = GetObjectGenNum(objnum);
+ uint32_t oldgen = GetObjectGenNum(objnum);
m_ObjectInfo[objnum].pos = obj_pos;
m_ObjectInfo[objnum].gennum = gennum;
if (oldgen != gennum)
@@ -819,7 +819,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
const CFX_ByteString& key = it->first;
CPDF_Object* pElement = it->second;
++it;
- FX_DWORD dwObjNum =
+ uint32_t dwObjNum =
pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
m_pTrailer->SetAtReference(key, m_pDocument,
@@ -987,8 +987,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
std::vector<std::pair<int32_t, int32_t>> arrIndex;
CPDF_Array* pArray = pStream->GetDict()->GetArrayBy("Index");
if (pArray) {
- FX_DWORD nPairSize = pArray->GetCount() / 2;
- for (FX_DWORD i = 0; i < nPairSize; i++) {
+ uint32_t nPairSize = pArray->GetCount() / 2;
+ for (uint32_t i = 0; i < nPairSize; i++) {
CPDF_Object* pStartNumObj = pArray->GetElement(i * 2);
CPDF_Object* pCountObj = pArray->GetElement(i * 2 + 1);
@@ -1010,9 +1010,9 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
return FALSE;
}
- CFX_ArrayTemplate<FX_DWORD> WidthArray;
+ CFX_ArrayTemplate<uint32_t> WidthArray;
FX_SAFE_DWORD dwAccWidth = 0;
- for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
+ for (uint32_t i = 0; i < pArray->GetCount(); i++) {
WidthArray.Add(pArray->GetIntegerAt(i));
dwAccWidth += WidthArray[i];
}
@@ -1022,22 +1022,22 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
return FALSE;
}
- FX_DWORD totalWidth = dwAccWidth.ValueOrDie();
+ uint32_t totalWidth = dwAccWidth.ValueOrDie();
CPDF_StreamAcc acc;
acc.LoadAllData(pStream);
const uint8_t* pData = acc.GetData();
- FX_DWORD dwTotalSize = acc.GetSize();
- FX_DWORD segindex = 0;
- for (FX_DWORD i = 0; i < arrIndex.size(); i++) {
+ uint32_t dwTotalSize = acc.GetSize();
+ uint32_t segindex = 0;
+ for (uint32_t i = 0; i < arrIndex.size(); i++) {
int32_t startnum = arrIndex[i].first;
if (startnum < 0)
continue;
m_dwXrefStartObjNum =
- pdfium::base::checked_cast<FX_DWORD, int32_t>(startnum);
- FX_DWORD count =
- pdfium::base::checked_cast<FX_DWORD, int32_t>(arrIndex[i].second);
+ pdfium::base::checked_cast<uint32_t, int32_t>(startnum);
+ uint32_t count =
+ pdfium::base::checked_cast<uint32_t, int32_t>(arrIndex[i].second);
FX_SAFE_DWORD dwCaculatedSize = segindex;
dwCaculatedSize += count;
dwCaculatedSize *= totalWidth;
@@ -1049,11 +1049,11 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
const uint8_t* segstart = pData + segindex * totalWidth;
FX_SAFE_DWORD dwMaxObjNum = startnum;
dwMaxObjNum += count;
- FX_DWORD dwV5Size = m_ObjectInfo.empty() ? 0 : GetLastObjNum() + 1;
+ uint32_t dwV5Size = m_ObjectInfo.empty() ? 0 : GetLastObjNum() + 1;
if (!dwMaxObjNum.IsValid() || dwMaxObjNum.ValueOrDie() > dwV5Size)
continue;
- for (FX_DWORD j = 0; j < count; j++) {
+ for (uint32_t j = 0; j < count; j++) {
int32_t type = 1;
const uint8_t* entrystart = segstart + j * totalWidth;
if (WidthArray[0])
@@ -1106,19 +1106,19 @@ CPDF_Array* CPDF_Parser::GetIDArray() {
return ToArray(pID);
}
-FX_DWORD CPDF_Parser::GetRootObjNum() {
+uint32_t CPDF_Parser::GetRootObjNum() {
CPDF_Reference* pRef =
ToReference(m_pTrailer ? m_pTrailer->GetElement("Root") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
-FX_DWORD CPDF_Parser::GetInfoObjNum() {
+uint32_t CPDF_Parser::GetInfoObjNum() {
CPDF_Reference* pRef =
ToReference(m_pTrailer ? m_pTrailer->GetElement("Info") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
-FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
+FX_BOOL CPDF_Parser::IsFormStream(uint32_t objnum, FX_BOOL& bForm) {
bForm = FALSE;
if (!IsValidObjectNumber(objnum))
return TRUE;
@@ -1150,7 +1150,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
CPDF_Object* CPDF_Parser::ParseIndirectObject(
CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum) {
+ uint32_t objnum) {
if (!IsValidObjectNumber(objnum))
return nullptr;
@@ -1158,7 +1158,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
if (pdfium::ContainsKey(m_ParsingObjNums, objnum))
return nullptr;
- pdfium::ScopedSetInsertion<FX_DWORD> local_insert(&m_ParsingObjNums, objnum);
+ pdfium::ScopedSetInsertion<uint32_t> local_insert(&m_ParsingObjNums, objnum);
if (GetObjectType(objnum) == 1 || GetObjectType(objnum) == 255) {
FX_FILESIZE pos = m_ObjectInfo[objnum].pos;
if (pos <= 0)
@@ -1181,8 +1181,8 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
// Read object numbers from |pObjStream| into a cache.
if (!pdfium::ContainsKey(m_ObjCache, pObjStream)) {
for (int32_t i = GetStreamNCount(pObjStream); i > 0; --i) {
- FX_DWORD thisnum = syntax.GetDirectNum();
- FX_DWORD thisoff = syntax.GetDirectNum();
+ uint32_t thisnum = syntax.GetDirectNum();
+ uint32_t thisoff = syntax.GetDirectNum();
m_ObjCache[pObjStream][thisnum] = thisoff;
}
}
@@ -1195,7 +1195,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObject(
return syntax.GetObject(pObjList, 0, 0, true);
}
-CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) {
+CPDF_StreamAcc* CPDF_Parser::GetObjectStream(uint32_t objnum) {
auto it = m_ObjectStreamMap.find(objnum);
if (it != m_ObjectStreamMap.end())
return it->second.get();
@@ -1213,7 +1213,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) {
return pStreamAcc;
}
-FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) const {
+FX_FILESIZE CPDF_Parser::GetObjectSize(uint32_t objnum) const {
if (!IsValidObjectNumber(objnum))
return 0;
@@ -1234,9 +1234,9 @@ FX_FILESIZE CPDF_Parser::GetObjectSize(FX_DWORD objnum) const {
return *it - offset;
}
-void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
+void CPDF_Parser::GetIndirectBinary(uint32_t objnum,
uint8_t*& pBuffer,
- FX_DWORD& size) {
+ uint32_t& size) {
pBuffer = nullptr;
size = 0;
if (!IsValidObjectNumber(objnum))
@@ -1249,15 +1249,15 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
int32_t offset = GetStreamFirst(pObjStream);
const uint8_t* pData = pObjStream->GetData();
- FX_DWORD totalsize = pObjStream->GetSize();
+ uint32_t totalsize = pObjStream->GetSize();
ScopedFileStream file(
FX_CreateMemoryStream((uint8_t*)pData, (size_t)totalsize, FALSE));
CPDF_SyntaxParser syntax;
syntax.InitParser(file.get(), 0);
for (int i = GetStreamNCount(pObjStream); i > 0; --i) {
- FX_DWORD thisnum = syntax.GetDirectNum();
- FX_DWORD thisoff = syntax.GetDirectNum();
+ uint32_t thisnum = syntax.GetDirectNum();
+ uint32_t thisoff = syntax.GetDirectNum();
if (thisnum != objnum)
continue;
@@ -1265,7 +1265,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
size = totalsize - (thisoff + offset);
} else {
syntax.GetDirectNum(); // Skip nextnum.
- FX_DWORD nextoff = syntax.GetDirectNum();
+ uint32_t nextoff = syntax.GetDirectNum();
size = nextoff - thisoff;
}
@@ -1293,7 +1293,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
return;
}
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (parser_objnum && parser_objnum != objnum) {
m_pSyntax->RestorePos(SavedPos);
return;
@@ -1343,7 +1343,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
nextoff = m_pSyntax->SavePos();
}
- size = (FX_DWORD)(nextoff - pos);
+ size = (uint32_t)(nextoff - pos);
pBuffer = FX_Alloc(uint8_t, size);
m_pSyntax->RestorePos(pos);
m_pSyntax->ReadBlock(pBuffer, size);
@@ -1353,7 +1353,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum) {
+ uint32_t objnum) {
FX_FILESIZE SavedPos = m_pSyntax->SavePos();
m_pSyntax->RestorePos(pos);
bool bIsNumber;
@@ -1365,7 +1365,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
FX_FILESIZE objOffset = m_pSyntax->SavePos();
objOffset -= word.GetLength();
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (objnum && parser_objnum != objnum) {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1377,7 +1377,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
return nullptr;
}
- FX_DWORD parser_gennum = FXSYS_atoui(word);
+ uint32_t parser_gennum = FXSYS_atoui(word);
if (m_pSyntax->GetKeyword() != "obj") {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1403,7 +1403,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(
CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
FX_FILESIZE* pResultPos) {
FX_FILESIZE SavedPos = m_pSyntax->SavePos();
m_pSyntax->RestorePos(pos);
@@ -1415,7 +1415,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
return nullptr;
}
- FX_DWORD parser_objnum = FXSYS_atoui(word);
+ uint32_t parser_objnum = FXSYS_atoui(word);
if (objnum && parser_objnum != objnum) {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1427,7 +1427,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
return nullptr;
}
- FX_DWORD gennum = FXSYS_atoui(word);
+ uint32_t gennum = FXSYS_atoui(word);
if (m_pSyntax->GetKeyword() != "obj") {
m_pSyntax->RestorePos(SavedPos);
return nullptr;
@@ -1452,11 +1452,11 @@ CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() {
return pObj.release()->AsDictionary();
}
-FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
+uint32_t CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
if (!m_pSecurityHandler)
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
- FX_DWORD dwPermission = m_pSecurityHandler->GetPermissions();
+ uint32_t dwPermission = m_pSecurityHandler->GetPermissions();
if (m_pEncryptDict && m_pEncryptDict->GetStringBy("Filter") == "Standard") {
dwPermission &= 0xFFFFFFFC;
dwPermission |= 0xFFFFF0C0;
@@ -1467,7 +1467,7 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
}
FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
- FX_DWORD offset) {
+ uint32_t offset) {
m_pSyntax->InitParser(pFileAccess, offset);
m_pSyntax->RestorePos(m_pSyntax->m_HeaderOffset + 9);
@@ -1477,12 +1477,12 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
if (!bIsNumber)
return FALSE;
- FX_DWORD objnum = FXSYS_atoui(word);
+ uint32_t objnum = FXSYS_atoui(word);
word = m_pSyntax->GetNextWord(&bIsNumber);
if (!bIsNumber)
return FALSE;
- FX_DWORD gennum = FXSYS_atoui(word);
+ uint32_t gennum = FXSYS_atoui(word);
if (m_pSyntax->GetKeyword() != "obj") {
m_pSyntax->RestorePos(SavedPos);
return FALSE;
@@ -1617,7 +1617,7 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV5(FX_FILESIZE xrefpos) {
}
CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
- FX_DWORD dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum;
+ uint32_t dwSaveMetadataObjnum = m_pSyntax->m_MetadataObjnum;
m_pSyntax->m_MetadataObjnum = 0;
if (m_pTrailer) {
m_pTrailer->Release();
@@ -1626,7 +1626,7 @@ CPDF_Parser::Error CPDF_Parser::LoadLinearizedMainXRefTable() {
m_pSyntax->RestorePos(m_LastXRefOffset - m_pSyntax->m_HeaderOffset);
uint8_t ch = 0;
- FX_DWORD dwCount = 0;
+ uint32_t dwCount = 0;
m_pSyntax->GetNextChar(ch);
while (PDFCharIsWhitespace(ch)) {
++dwCount;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
index 6aa8fe9b4a..9053d08b36 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp
@@ -62,7 +62,7 @@ CPDF_Object* CPDF_Reference::Clone(FX_BOOL bDirect) const {
return new CPDF_Reference(m_pObjList, m_RefObjNum);
}
-void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum) {
+void CPDF_Reference::SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum) {
m_pObjList = pDoc;
m_RefObjNum = objnum;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp
index a13fb0f365..e32021e25d 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp
@@ -8,13 +8,13 @@
#include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h"
-CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize)
+CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize)
: m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {}
CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str)
: m_pData(str.GetPtr()), m_dwSize(str.GetLength()), m_dwCurPos(0) {}
-void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) {
+void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) {
pStart = nullptr;
dwSize = 0;
uint8_t ch;
@@ -40,7 +40,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) {
}
}
- FX_DWORD start_pos = m_dwCurPos - 1;
+ uint32_t start_pos = m_dwCurPos - 1;
pStart = m_pData + start_pos;
if (PDFCharIsDelimiter(ch)) {
if (ch == '/') {
@@ -93,7 +93,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize) {
CFX_ByteStringC CPDF_SimpleParser::GetWord() {
const uint8_t* pStart;
- FX_DWORD dwSize;
+ uint32_t dwSize;
ParseWord(pStart, dwSize);
if (dwSize == 1 && pStart[0] == '<') {
while (m_dwCurPos < m_dwSize && m_pData[m_dwCurPos] != '>') {
@@ -139,7 +139,7 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() {
bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token,
int nParams) {
nParams++;
- FX_DWORD* pBuf = FX_Alloc(FX_DWORD, nParams);
+ uint32_t* pBuf = FX_Alloc(uint32_t, nParams);
int buf_index = 0;
int buf_count = 0;
m_dwCurPos = 0;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp
index 17ef914c80..46384244e8 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp
@@ -15,8 +15,8 @@
IPDF_CryptoHandler::~IPDF_CryptoHandler() {}
-void IPDF_CryptoHandler::Decrypt(FX_DWORD objnum,
- FX_DWORD gennum,
+void IPDF_CryptoHandler::Decrypt(uint32_t objnum,
+ uint32_t gennum,
CFX_ByteString& str) {
CFX_BinaryBuf dest_buf;
void* context = DecryptStart(objnum, gennum);
@@ -26,12 +26,12 @@ void IPDF_CryptoHandler::Decrypt(FX_DWORD objnum,
}
void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
if (m_Cipher == FXCIPHER_NONE) {
FXSYS_memcpy(dest_buf, src_buf, src_size);
return;
@@ -96,11 +96,11 @@ struct AESCryptContext {
uint8_t m_Context[2048];
FX_BOOL m_bIV;
uint8_t m_Block[16];
- FX_DWORD m_BlockOffset;
+ uint32_t m_BlockOffset;
};
-void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum,
- FX_DWORD gennum,
+void* CPDF_StandardCryptoHandler::CryptStart(uint32_t objnum,
+ uint32_t gennum,
FX_BOOL bEncrypt) {
if (m_Cipher == FXCIPHER_NONE) {
return this;
@@ -151,7 +151,7 @@ void* CPDF_StandardCryptoHandler::CryptStart(FX_DWORD objnum,
}
FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf,
FX_BOOL bEncrypt) {
if (!context) {
@@ -172,10 +172,10 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptStream(void* context,
dest_buf.AppendBlock(pContext->m_Block, 16);
pContext->m_bIV = FALSE;
}
- FX_DWORD src_off = 0;
- FX_DWORD src_left = src_size;
+ uint32_t src_off = 0;
+ uint32_t src_left = src_size;
while (1) {
- FX_DWORD copy_size = 16 - pContext->m_BlockOffset;
+ uint32_t copy_size = 16 - pContext->m_BlockOffset;
if (copy_size > src_left) {
copy_size = src_left;
}
@@ -244,11 +244,11 @@ FX_BOOL CPDF_StandardCryptoHandler::CryptFinish(void* context,
FX_Free(pContext);
return TRUE;
}
-void* CPDF_StandardCryptoHandler::DecryptStart(FX_DWORD objnum,
- FX_DWORD gennum) {
+void* CPDF_StandardCryptoHandler::DecryptStart(uint32_t objnum,
+ uint32_t gennum) {
return CryptStart(objnum, gennum, FALSE);
}
-FX_DWORD CPDF_StandardCryptoHandler::DecryptGetSize(FX_DWORD src_size) {
+uint32_t CPDF_StandardCryptoHandler::DecryptGetSize(uint32_t src_size) {
return m_Cipher == FXCIPHER_AES ? src_size - 16 : src_size;
}
@@ -306,7 +306,7 @@ FX_BOOL CPDF_StandardCryptoHandler::Init(int cipher,
}
FX_BOOL CPDF_StandardCryptoHandler::DecryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf) {
return CryptStream(context, src_buf, src_size, dest_buf, FALSE);
}
@@ -314,21 +314,21 @@ FX_BOOL CPDF_StandardCryptoHandler::DecryptFinish(void* context,
CFX_BinaryBuf& dest_buf) {
return CryptFinish(context, dest_buf, FALSE);
}
-FX_DWORD CPDF_StandardCryptoHandler::EncryptGetSize(FX_DWORD objnum,
- FX_DWORD version,
+uint32_t CPDF_StandardCryptoHandler::EncryptGetSize(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size) {
+ uint32_t src_size) {
if (m_Cipher == FXCIPHER_AES) {
return src_size + 32;
}
return src_size;
}
-FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(FX_DWORD objnum,
- FX_DWORD gennum,
+FX_BOOL CPDF_StandardCryptoHandler::EncryptContent(uint32_t objnum,
+ uint32_t gennum,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CryptBlock(TRUE, objnum, gennum, src_buf, src_size, dest_buf, dest_size);
return TRUE;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h
index c40fa7d0a4..689d44b81b 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h
@@ -17,38 +17,38 @@ class CPDF_StandardCryptoHandler : public IPDF_CryptoHandler {
// IPDF_CryptoHandler
FX_BOOL Init(CPDF_Dictionary* pEncryptDict,
IPDF_SecurityHandler* pSecurityHandler) override;
- FX_DWORD DecryptGetSize(FX_DWORD src_size) override;
- void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) override;
+ uint32_t DecryptGetSize(uint32_t src_size) override;
+ void* DecryptStart(uint32_t objnum, uint32_t gennum) override;
FX_BOOL DecryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf) override;
FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) override;
- FX_DWORD EncryptGetSize(FX_DWORD objnum,
- FX_DWORD version,
+ uint32_t EncryptGetSize(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size) override;
- FX_BOOL EncryptContent(FX_DWORD objnum,
- FX_DWORD version,
+ uint32_t src_size) override;
+ FX_BOOL EncryptContent(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) override;
+ uint32_t& dest_size) override;
FX_BOOL Init(int cipher, const uint8_t* key, int keylen);
protected:
virtual void CryptBlock(FX_BOOL bEncrypt,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size);
- virtual void* CryptStart(FX_DWORD objnum, FX_DWORD gennum, FX_BOOL bEncrypt);
+ uint32_t& dest_size);
+ virtual void* CryptStart(uint32_t objnum, uint32_t gennum, FX_BOOL bEncrypt);
virtual FX_BOOL CryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf,
FX_BOOL bEncrypt);
virtual FX_BOOL CryptFinish(void* context,
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
index 14e7ed65d3..ac7667c3ea 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
@@ -24,14 +24,14 @@ const uint8_t defpasscode[32] = {
void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
uint8_t* key,
int keylen,
FX_BOOL bIgnoreMeta,
CPDF_Array* pIdArray) {
int revision = pEncrypt->GetIntegerBy("R");
uint8_t passcode[32];
- for (FX_DWORD i = 0; i < 32; i++) {
+ for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size];
}
uint8_t md5[100];
@@ -39,7 +39,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
CRYPT_MD5Update(md5, passcode, 32);
CFX_ByteString okey = pEncrypt->GetStringBy("O");
CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength());
- FX_DWORD perm = pEncrypt->GetIntegerBy("P");
+ uint32_t perm = pEncrypt->GetIntegerBy("P");
CRYPT_MD5Update(md5, (uint8_t*)&perm, 4);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetStringAt(0);
@@ -47,12 +47,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
}
if (!bIgnoreMeta && revision >= 3 &&
!pEncrypt->GetIntegerBy("EncryptMetadata", 1)) {
- FX_DWORD tag = (FX_DWORD)-1;
+ uint32_t tag = (uint32_t)-1;
CRYPT_MD5Update(md5, (uint8_t*)&tag, 4);
}
uint8_t digest[16];
CRYPT_MD5Finish(md5, digest);
- FX_DWORD copy_len = keylen;
+ uint32_t copy_len = keylen;
if (copy_len > sizeof(digest)) {
copy_len = sizeof(digest);
}
@@ -111,7 +111,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckSecurity(int32_t key_len) {
return CheckPassword(password, password.GetLength(), FALSE, m_EncryptKey,
key_len);
}
-FX_DWORD CPDF_StandardSecurityHandler::GetPermissions() {
+uint32_t CPDF_StandardSecurityHandler::GetPermissions() {
return m_Permissions;
}
static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
@@ -180,7 +180,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
}
FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
- FX_DWORD type,
+ uint32_t type,
int& cipher,
int& key_len) {
m_pEncryptDict = pEncryptDict;
@@ -213,14 +213,14 @@ FX_BOOL CPDF_StandardSecurityHandler::GetCryptInfo(int& cipher,
}
#define FX_GET_32WORD(n, b, i) \
{ \
- (n) = (FX_DWORD)( \
+ (n) = (uint32_t)( \
((uint64_t)(b)[(i)] << 24) | ((uint64_t)(b)[(i) + 1] << 16) | \
((uint64_t)(b)[(i) + 2] << 8) | ((uint64_t)(b)[(i) + 3])); \
}
int BigOrder64BitsMod3(uint8_t* data) {
uint64_t ret = 0;
for (int i = 0; i < 4; ++i) {
- FX_DWORD value;
+ uint32_t value;
FX_GET_32WORD(value, data, 4 * i);
ret <<= 32;
ret |= value;
@@ -229,7 +229,7 @@ int BigOrder64BitsMod3(uint8_t* data) {
return (int)ret;
}
void Revision6_Hash(const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
const uint8_t* salt,
const uint8_t* vector,
uint8_t* hash) {
@@ -306,7 +306,7 @@ void Revision6_Hash(const uint8_t* password,
}
FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
uint8_t* key) {
CFX_ByteString okey =
@@ -372,8 +372,8 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
}
uint8_t perms_buf[16];
FXSYS_memset(perms_buf, 0, sizeof(perms_buf));
- FX_DWORD copy_len = sizeof(perms_buf);
- if (copy_len > (FX_DWORD)perms.GetLength()) {
+ uint32_t copy_len = sizeof(perms_buf);
+ if (copy_len > (uint32_t)perms.GetLength()) {
copy_len = perms.GetLength();
}
FXSYS_memcpy(perms_buf, (const uint8_t*)perms, copy_len);
@@ -394,7 +394,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
}
int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
uint8_t* key,
int32_t key_len) {
@@ -413,7 +413,7 @@ int CPDF_StandardSecurityHandler::CheckPassword(const uint8_t* password,
}
FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
FX_BOOL bIgnoreEncryptMeta,
uint8_t* key,
int32_t key_len) {
@@ -430,8 +430,8 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len);
} else {
uint8_t test[32], tmpkey[32];
- FX_DWORD copy_len = sizeof(test);
- if (copy_len > (FX_DWORD)ukey.GetLength()) {
+ uint32_t copy_len = sizeof(test);
+ if (copy_len > (uint32_t)ukey.GetLength()) {
copy_len = ukey.GetLength();
}
FXSYS_memset(test, 0, sizeof(test));
@@ -461,11 +461,11 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
}
CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
const uint8_t* owner_pass,
- FX_DWORD pass_size,
+ uint32_t pass_size,
int32_t key_len) {
CFX_ByteString okey = m_pEncryptDict->GetStringBy("O");
uint8_t passcode[32];
- FX_DWORD i;
+ uint32_t i;
for (i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
}
@@ -478,7 +478,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
}
uint8_t enckey[32];
FXSYS_memset(enckey, 0, sizeof(enckey));
- FX_DWORD copy_len = key_len;
+ uint32_t copy_len = key_len;
if (copy_len > sizeof(digest)) {
copy_len = sizeof(digest);
}
@@ -510,7 +510,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
}
FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(
const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
uint8_t* key,
int32_t key_len) {
CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
@@ -528,11 +528,11 @@ FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted() {
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
+ uint32_t owner_size,
FX_BOOL bDefault,
- FX_DWORD type) {
+ uint32_t type) {
int cipher = 0, key_len = 0;
if (!LoadDict(pEncryptDict, type, cipher, key_len)) {
return;
@@ -561,7 +561,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
}
if (bDefault) {
uint8_t passcode[32];
- FX_DWORD i;
+ uint32_t i;
for (i = 0; i < 32; i++) {
passcode[i] =
i < owner_size ? owner_pass[i] : defpasscode[i - owner_size];
@@ -622,24 +622,24 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
- FX_DWORD type) {
+ uint32_t owner_size,
+ uint32_t type) {
OnCreate(pEncryptDict, pIdArray, user_pass, user_size, owner_pass, owner_size,
TRUE, type);
}
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
- FX_DWORD type) {
+ uint32_t user_size,
+ uint32_t type) {
OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type);
}
void CPDF_StandardSecurityHandler::AES256_SetPassword(
CPDF_Dictionary* pEncryptDict,
const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
const uint8_t* key) {
uint8_t sha[128];
@@ -687,7 +687,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(
}
void CPDF_StandardSecurityHandler::AES256_SetPerms(
CPDF_Dictionary* pEncryptDict,
- FX_DWORD permissions,
+ uint32_t permissions,
FX_BOOL bEncryptMetadata,
const uint8_t* key) {
uint8_t buf[16];
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h
index 8c1629c486..dfbf6a34f9 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h
@@ -22,7 +22,7 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler {
// IPDF_SecurityHandler:
FX_BOOL OnInit(CPDF_Parser* pParser, CPDF_Dictionary* pEncryptDict) override;
- FX_DWORD GetPermissions() override;
+ uint32_t GetPermissions() override;
FX_BOOL GetCryptInfo(int& cipher,
const uint8_t*& buffer,
int& keylen) override;
@@ -32,22 +32,22 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler {
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
- FX_DWORD type = PDF_ENCRYPT_CONTENT);
+ uint32_t owner_size,
+ uint32_t type = PDF_ENCRYPT_CONTENT);
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
- FX_DWORD type = PDF_ENCRYPT_CONTENT);
+ uint32_t user_size,
+ uint32_t type = PDF_ENCRYPT_CONTENT);
CFX_ByteString GetUserPassword(const uint8_t* owner_pass,
- FX_DWORD pass_size,
+ uint32_t pass_size,
int32_t key_len);
int CheckPassword(const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
FX_BOOL bOwner,
uint8_t* key,
int key_len);
@@ -55,48 +55,48 @@ class CPDF_StandardSecurityHandler : public IPDF_SecurityHandler {
private:
FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict);
FX_BOOL LoadDict(CPDF_Dictionary* pEncryptDict,
- FX_DWORD type,
+ uint32_t type,
int& cipher,
int& key_len);
FX_BOOL CheckUserPassword(const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
FX_BOOL bIgnoreEncryptMeta,
uint8_t* key,
int32_t key_len);
FX_BOOL CheckOwnerPassword(const uint8_t* password,
- FX_DWORD pass_size,
+ uint32_t pass_size,
uint8_t* key,
int32_t key_len);
FX_BOOL AES256_CheckPassword(const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
uint8_t* key);
void AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
const uint8_t* password,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bOwner,
const uint8_t* key);
void AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
- FX_DWORD permission,
+ uint32_t permission,
FX_BOOL bEncryptMetadata,
const uint8_t* key);
void OnCreate(CPDF_Dictionary* pEncryptDict,
CPDF_Array* pIdArray,
const uint8_t* user_pass,
- FX_DWORD user_size,
+ uint32_t user_size,
const uint8_t* owner_pass,
- FX_DWORD owner_size,
+ uint32_t owner_size,
FX_BOOL bDefault,
- FX_DWORD type);
+ uint32_t type);
FX_BOOL CheckSecurity(int32_t key_len);
int m_Version;
int m_Revision;
CPDF_Parser* m_pParser;
CPDF_Dictionary* m_pEncryptDict;
- FX_DWORD m_Permissions;
+ uint32_t m_Permissions;
int m_Cipher;
uint8_t m_EncryptKey[32];
int m_KeyLen;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
index 72ecb7e9de..108f487602 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
@@ -10,7 +10,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
-CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict)
+CPDF_Stream::CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict)
: m_pDict(pDict),
m_dwSize(size),
m_GenNum(kMemoryBasedGenNum),
@@ -58,7 +58,7 @@ void CPDF_Stream::InitStreamInternal(CPDF_Dictionary* pDict) {
}
void CPDF_Stream::InitStream(uint8_t* pData,
- FX_DWORD size,
+ uint32_t size,
CPDF_Dictionary* pDict) {
InitStreamInternal(pDict);
m_GenNum = kMemoryBasedGenNum;
@@ -74,7 +74,7 @@ void CPDF_Stream::InitStream(uint8_t* pData,
CPDF_Object* CPDF_Stream::Clone(FX_BOOL bDirect) const {
CPDF_StreamAcc acc;
acc.LoadAllData(this, TRUE);
- FX_DWORD streamSize = acc.GetSize();
+ uint32_t streamSize = acc.GetSize();
CPDF_Dictionary* pDict = GetDict();
if (pDict)
pDict = ToDictionary(pDict->Clone(bDirect));
@@ -83,7 +83,7 @@ CPDF_Object* CPDF_Stream::Clone(FX_BOOL bDirect) const {
}
void CPDF_Stream::SetData(const uint8_t* pData,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bCompressed,
FX_BOOL bKeepBuf) {
if (IsMemoryBased())
@@ -110,7 +110,7 @@ void CPDF_Stream::SetData(const uint8_t* pData,
FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset,
uint8_t* buf,
- FX_DWORD size) const {
+ uint32_t size) const {
if (!IsMemoryBased() && m_pFile)
return m_pFile->ReadBlock(buf, offset, size);
@@ -124,7 +124,7 @@ void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile,
CPDF_Dictionary* pDict) {
InitStreamInternal(pDict);
m_pFile = pFile;
- m_dwSize = (FX_DWORD)pFile->GetSize();
+ m_dwSize = (uint32_t)pFile->GetSize();
if (m_pDict)
m_pDict->SetAtInteger("Length", m_dwSize);
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp
index f10e33758c..afac3ebf6f 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp
@@ -18,7 +18,7 @@ CPDF_StreamAcc::CPDF_StreamAcc()
void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
FX_BOOL bRawAccess,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
FX_BOOL bImageAcc) {
if (!pStream)
return;
@@ -31,7 +31,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
return;
}
uint8_t* pSrcData;
- FX_DWORD dwSrcSize = pStream->GetRawSize();
+ uint32_t dwSrcSize = pStream->GetRawSize();
if (dwSrcSize == 0)
return;
@@ -43,7 +43,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
pSrcData = pStream->GetRawData();
}
uint8_t* pDecryptedData = pSrcData;
- FX_DWORD dwDecryptedSize = dwSrcSize;
+ uint32_t dwDecryptedSize = dwSrcSize;
if (!pStream->GetDict()->KeyExist("Filter") || bRawAccess) {
m_pData = pDecryptedData;
m_dwSize = dwDecryptedSize;
@@ -83,7 +83,7 @@ const uint8_t* CPDF_StreamAcc::GetData() const {
return m_pStream->GetRawData();
}
-FX_DWORD CPDF_StreamAcc::GetSize() const {
+uint32_t CPDF_StreamAcc::GetSize() const {
if (m_bNewBuf) {
return m_dwSize;
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
index 00e2ee6a13..d14eeb991c 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
@@ -28,8 +28,8 @@ namespace {
struct SearchTagRecord {
const char* m_pTag;
- FX_DWORD m_Len;
- FX_DWORD m_Offset;
+ uint32_t m_Len;
+ uint32_t m_Offset;
};
} // namespace
@@ -60,14 +60,14 @@ FX_BOOL CPDF_SyntaxParser::GetNextChar(uint8_t& ch) {
if (m_BufOffset >= pos || (FX_FILESIZE)(m_BufOffset + m_BufSize) <= pos) {
FX_FILESIZE read_pos = pos;
- FX_DWORD read_size = m_BufSize;
+ uint32_t read_size = m_BufSize;
if ((FX_FILESIZE)read_size > m_FileLen)
- read_size = (FX_DWORD)m_FileLen;
+ read_size = (uint32_t)m_FileLen;
if ((FX_FILESIZE)(read_pos + read_size) > m_FileLen) {
if (m_FileLen < (FX_FILESIZE)read_size) {
read_pos = 0;
- read_size = (FX_DWORD)m_FileLen;
+ read_size = (uint32_t)m_FileLen;
} else {
read_pos = m_FileLen - read_size;
}
@@ -95,11 +95,11 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
else
read_pos = pos - m_BufSize + 1;
- FX_DWORD read_size = m_BufSize;
+ uint32_t read_size = m_BufSize;
if ((FX_FILESIZE)(read_pos + read_size) > m_FileLen) {
if (m_FileLen < (FX_FILESIZE)read_size) {
read_pos = 0;
- read_size = (FX_DWORD)m_FileLen;
+ read_size = (uint32_t)m_FileLen;
} else {
read_pos = m_FileLen - read_size;
}
@@ -114,7 +114,7 @@ FX_BOOL CPDF_SyntaxParser::GetCharAtBackward(FX_FILESIZE pos, uint8_t& ch) {
return TRUE;
}
-FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, FX_DWORD size) {
+FX_BOOL CPDF_SyntaxParser::ReadBlock(uint8_t* pBuf, uint32_t size) {
if (!m_pFileAccess->ReadBlock(pBuf, m_Pos + m_HeaderOffset, size))
return FALSE;
m_Pos += size;
@@ -375,8 +375,8 @@ CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
}
CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
FX_BOOL bDecrypt) {
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
@@ -394,7 +394,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
if (bIsNumber) {
CFX_ByteString nextword2 = GetNextWord(nullptr);
if (nextword2 == "R") {
- FX_DWORD objnum = FXSYS_atoui(word);
+ uint32_t objnum = FXSYS_atoui(word);
return new CPDF_Reference(pObjList, objnum);
}
}
@@ -500,8 +500,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum) {
+ uint32_t objnum,
+ uint32_t gennum) {
CFX_AutoRestorer<int> restorer(&s_CurrentRecursionDepth);
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
return nullptr;
@@ -628,8 +628,8 @@ unsigned int CPDF_SyntaxParser::ReadEOLMarkers(FX_FILESIZE pos) {
}
CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
- FX_DWORD objnum,
- FX_DWORD gennum) {
+ uint32_t objnum,
+ uint32_t gennum) {
CPDF_Object* pLenObj = pDict->GetElement("Length");
FX_FILESIZE len = -1;
CPDF_Reference* pLenObjRef = ToReference(pLenObj);
@@ -647,7 +647,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
const CFX_ByteStringC kEndObjStr("endobj");
IPDF_CryptoHandler* pCryptoHandler =
- objnum == (FX_DWORD)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get();
+ objnum == (uint32_t)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get();
if (!pCryptoHandler) {
FX_BOOL bSearchForKeyword = TRUE;
if (len >= 0) {
@@ -782,7 +782,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
void CPDF_SyntaxParser::InitParser(IFX_FileRead* pFileAccess,
- FX_DWORD HeaderOffset) {
+ uint32_t HeaderOffset) {
FX_Free(m_pFileBuf);
m_pFileBuf = FX_Alloc(uint8_t, m_BufSize);
@@ -810,7 +810,7 @@ bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
const CFX_ByteStringC& tag,
FX_BOOL checkKeyword) {
- const FX_DWORD taglen = tag.GetLength();
+ const uint32_t taglen = tag.GetLength();
bool bCheckLeft = !PDFCharIsDelimiter(tag[0]) && !PDFCharIsWhitespace(tag[0]);
bool bCheckRight = !PDFCharIsDelimiter(tag[taglen - 1]) &&
@@ -914,12 +914,12 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags,
}
std::vector<SearchTagRecord> patterns(ntags);
- FX_DWORD start = 0;
- FX_DWORD itag = 0;
- FX_DWORD max_len = 0;
+ uint32_t start = 0;
+ uint32_t itag = 0;
+ uint32_t max_len = 0;
for (int i = 0; i <= tags.GetLength(); ++i) {
if (tags[i] == 0) {
- FX_DWORD len = i - start;
+ uint32_t len = i - start;
max_len = std::max(len, max_len);
patterns[itag].m_pTag = tags.GetCStr() + start;
patterns[itag].m_Len = len;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
index 2e613d5cd9..26b6a8d3df 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h
@@ -23,18 +23,18 @@ class CPDF_SyntaxParser {
CPDF_SyntaxParser();
~CPDF_SyntaxParser();
- void InitParser(IFX_FileRead* pFileAccess, FX_DWORD HeaderOffset);
+ void InitParser(IFX_FileRead* pFileAccess, uint32_t HeaderOffset);
FX_FILESIZE SavePos() const { return m_Pos; }
void RestorePos(FX_FILESIZE pos) { m_Pos = pos; }
CPDF_Object* GetObject(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum,
+ uint32_t objnum,
+ uint32_t gennum,
FX_BOOL bDecrypt);
CPDF_Object* GetObjectByStrict(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum,
- FX_DWORD gennum);
+ uint32_t objnum,
+ uint32_t gennum);
CFX_ByteString GetKeyword();
void ToNextLine();
@@ -51,7 +51,7 @@ class CPDF_SyntaxParser {
void SetEncrypt(std::unique_ptr<IPDF_CryptoHandler> pCryptoHandler);
- FX_BOOL ReadBlock(uint8_t* pBuf, FX_DWORD size);
+ FX_BOOL ReadBlock(uint8_t* pBuf, uint32_t size);
FX_BOOL GetCharAt(FX_FILESIZE pos, uint8_t& ch);
CFX_ByteString GetNextWord(bool* bIsNumber);
@@ -77,20 +77,20 @@ class CPDF_SyntaxParser {
CFX_ByteString ReadHexString();
unsigned int ReadEOLMarkers(FX_FILESIZE pos);
CPDF_Stream* ReadStream(CPDF_Dictionary* pDict,
- FX_DWORD objnum,
- FX_DWORD gennum);
+ uint32_t objnum,
+ uint32_t gennum);
FX_FILESIZE m_Pos;
int m_MetadataObjnum;
IFX_FileRead* m_pFileAccess;
- FX_DWORD m_HeaderOffset;
+ uint32_t m_HeaderOffset;
FX_FILESIZE m_FileLen;
uint8_t* m_pFileBuf;
- FX_DWORD m_BufSize;
+ uint32_t m_BufSize;
FX_FILESIZE m_BufOffset;
std::unique_ptr<IPDF_CryptoHandler> m_pCryptoHandler;
uint8_t m_WordBuffer[257];
- FX_DWORD m_WordSize;
+ uint32_t m_WordSize;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_SYNTAX_PARSER_H_
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index e6f531da53..219a72507b 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -50,18 +50,18 @@ const uint16_t PDFDocEncoding[256] = {
0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb,
0x00fc, 0x00fd, 0x00fe, 0x00ff};
-FX_DWORD A85Decode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t A85Decode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
dest_size = 0;
dest_buf = nullptr;
if (src_size == 0)
return 0;
// Count legal characters and zeros.
- FX_DWORD zcount = 0;
- FX_DWORD pos = 0;
+ uint32_t zcount = 0;
+ uint32_t pos = 0;
while (pos < src_size) {
uint8_t ch = src_buf[pos];
if (ch == 'z') {
@@ -78,9 +78,9 @@ FX_DWORD A85Decode(const uint8_t* src_buf,
// Count the space needed to contain non-zero characters. The encoding ratio
// of Ascii85 is 4:5.
- FX_DWORD space_for_non_zeroes = (pos - zcount) / 5 * 4 + 4;
+ uint32_t space_for_non_zeroes = (pos - zcount) / 5 * 4 + 4;
if (zcount > (UINT_MAX - space_for_non_zeroes) / 4) {
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
}
dest_buf = FX_Alloc(uint8_t, zcount * 4 + space_for_non_zeroes);
size_t state = 0;
@@ -123,17 +123,17 @@ FX_DWORD A85Decode(const uint8_t* src_buf,
return pos;
}
-FX_DWORD HexDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t HexDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
dest_size = 0;
if (src_size == 0) {
dest_buf = nullptr;
return 0;
}
- FX_DWORD i = 0;
+ uint32_t i = 0;
// Find the end of data.
while (i < src_size && src_buf[i] != '>')
i++;
@@ -165,26 +165,26 @@ FX_DWORD HexDecode(const uint8_t* src_buf,
return i;
}
-FX_DWORD RunLengthDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t RunLengthDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
- FX_DWORD i = 0;
- FX_DWORD old;
+ uint32_t& dest_size) {
+ uint32_t i = 0;
+ uint32_t old;
dest_size = 0;
while (i < src_size) {
if (src_buf[i] < 128) {
old = dest_size;
dest_size += src_buf[i] + 1;
if (dest_size < old) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
i += src_buf[i] + 2;
} else if (src_buf[i] > 128) {
old = dest_size;
dest_size += 257 - src_buf[i];
if (dest_size < old) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
i += 2;
} else {
@@ -192,17 +192,17 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf,
}
}
if (dest_size >= _STREAM_MAX_SIZE_) {
- return static_cast<FX_DWORD>(-1);
+ return static_cast<uint32_t>(-1);
}
dest_buf = FX_Alloc(uint8_t, dest_size);
i = 0;
int dest_count = 0;
while (i < src_size) {
if (src_buf[i] < 128) {
- FX_DWORD copy_len = src_buf[i] + 1;
- FX_DWORD buf_left = src_size - i - 1;
+ uint32_t copy_len = src_buf[i] + 1;
+ uint32_t buf_left = src_size - i - 1;
if (buf_left < copy_len) {
- FX_DWORD delta = copy_len - buf_left;
+ uint32_t delta = copy_len - buf_left;
copy_len = buf_left;
FXSYS_memset(dest_buf + dest_count + copy_len, '\0', delta);
}
@@ -221,7 +221,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf,
break;
}
}
- FX_DWORD ret = i + 1;
+ uint32_t ret = i + 1;
if (ret > src_size) {
ret = src_size;
}
@@ -230,7 +230,7 @@ FX_DWORD RunLengthDecode(const uint8_t* src_buf,
ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
const CPDF_Dictionary* pParams) {
@@ -283,7 +283,7 @@ static FX_BOOL CheckFlateDecodeParams(int Colors,
ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -305,13 +305,13 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
BitsPerComponent, Columns);
}
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CPDF_Dictionary* pParams,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
int predictor = 0;
FX_BOOL bEarlyChange = TRUE;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
@@ -322,7 +322,7 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
BitsPerComponent = pParams->GetIntegerBy("BitsPerComponent", 8);
Columns = pParams->GetIntegerBy("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
- return (FX_DWORD)-1;
+ return (uint32_t)-1;
}
}
return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode(
@@ -331,13 +331,13 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
}
FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
const CPDF_Dictionary* pDict,
uint8_t*& dest_buf,
- FX_DWORD& dest_size,
+ uint32_t& dest_size,
CFX_ByteString& ImageEncoding,
CPDF_Dictionary*& pImageParms,
- FX_DWORD last_estimated_size,
+ uint32_t last_estimated_size,
FX_BOOL bImageAcc) {
CPDF_Object* pDecoder = pDict ? pDict->GetElementValue("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
@@ -352,7 +352,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
if (!pParamsArray)
pParams = nullptr;
- for (FX_DWORD i = 0; i < pDecoders->GetCount(); i++) {
+ for (uint32_t i = 0; i < pDecoders->GetCount(); i++) {
DecoderList.push_back(pDecoders->GetConstStringAt(i));
ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr);
}
@@ -361,7 +361,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
ParamList.Add(pParams ? pParams->GetDict() : nullptr);
}
uint8_t* last_buf = (uint8_t*)src_buf;
- FX_DWORD last_size = src_size;
+ uint32_t last_size = src_size;
int nSize = pdfium::CollectionSize<int>(DecoderList);
for (int i = 0; i < nSize; i++) {
int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
@@ -369,7 +369,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
// Use ToDictionary here because we can push nullptr into the ParamList.
CPDF_Dictionary* pParam = ToDictionary(ParamList[i]);
uint8_t* new_buf = nullptr;
- FX_DWORD new_size = (FX_DWORD)-1;
+ uint32_t new_size = (uint32_t)-1;
int offset = -1;
if (decoder == "FlateDecode" || decoder == "Fl") {
if (bImageAcc && i == nSize - 1) {
@@ -431,12 +431,12 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
return TRUE;
}
-CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) {
+CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
CFX_WideString result;
if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) ||
(src_data[0] == 0xff && src_data[1] == 0xfe))) {
bool bBE = src_data[0] == 0xfe;
- FX_DWORD max_chars = (src_len - 2) / 2;
+ uint32_t max_chars = (src_len - 2) / 2;
if (!max_chars) {
return result;
}
@@ -446,7 +446,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) {
FX_WCHAR* dest_buf = result.GetBuffer(max_chars);
const uint8_t* uni_str = src_data + 2;
int dest_pos = 0;
- for (FX_DWORD i = 0; i < max_chars * 2; i += 2) {
+ for (uint32_t i = 0; i < max_chars * 2; i += 2) {
uint16_t unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1])
: (uni_str[i + 1] << 8 | uni_str[i]);
if (unicode == 0x1b) {
@@ -466,7 +466,7 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, FX_DWORD src_len) {
result.ReleaseBuffer(dest_pos);
} else {
FX_WCHAR* dest_buf = result.GetBuffer(src_len);
- for (FX_DWORD i = 0; i < src_len; i++)
+ for (uint32_t i = 0; i < src_len; i++)
dest_buf[i] = PDFDocEncoding[src_data[i]];
result.ReleaseBuffer(src_len);
}
@@ -554,9 +554,9 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) {
}
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
pEncoders->GetFlateModule()->Encode(src_buf, src_size, dest_buf, dest_size);
@@ -564,13 +564,13 @@ void FlateEncode(const uint8_t* src_buf,
}
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
pEncoders->GetFlateModule()->Encode(src_buf, src_size, predictor, Colors,
@@ -579,10 +579,10 @@ void FlateEncode(const uint8_t* src_buf,
}
}
-FX_DWORD FlateDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t FlateDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size) {
+ uint32_t& dest_size) {
CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule();
if (pEncoders) {
return pEncoders->GetFlateModule()->FlateOrLZWDecode(
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
index 81f8cae354..352e4ee15c 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp
@@ -29,7 +29,7 @@ TEST(fpdf_parser_decode, A85Decode) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
pdfium::DecodeTestData* ptr = &test_data[i];
uint8_t* result = nullptr;
- FX_DWORD result_size;
+ uint32_t result_size;
EXPECT_EQ(ptr->processed_size,
A85Decode(ptr->input, ptr->input_size, result, result_size))
<< "for case " << i;
@@ -64,7 +64,7 @@ TEST(fpdf_parser_decode, HexDecode) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
pdfium::DecodeTestData* ptr = &test_data[i];
uint8_t* result = nullptr;
- FX_DWORD result_size;
+ uint32_t result_size;
EXPECT_EQ(ptr->processed_size,
HexDecode(ptr->input, ptr->input_size, result, result_size))
<< "for case " << i;
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index caffb6861b..5bfbfaebac 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -179,7 +179,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
case CPDF_Object::ARRAY: {
const CPDF_Array* p = pObj->AsArray();
buf << "[";
- for (FX_DWORD i = 0; i < p->GetCount(); i++) {
+ for (uint32_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetElement(i);
if (pElement->GetObjNum()) {
buf << " " << pElement->GetObjNum() << " 0 R";
diff --git a/core/fpdfapi/fpdf_parser/include/cfdf_document.h b/core/fpdfapi/fpdf_parser/include/cfdf_document.h
index f01039cd4e..18b9442fa9 100644
--- a/core/fpdfapi/fpdf_parser/include/cfdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cfdf_document.h
@@ -18,7 +18,7 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
static CFDF_Document* CreateNewDoc();
static CFDF_Document* ParseFile(IFX_FileRead* pFile,
FX_BOOL bOwnFile = FALSE);
- static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size);
+ static CFDF_Document* ParseMemory(const uint8_t* pData, uint32_t size);
~CFDF_Document();
FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
index 2ee7760a77..3efa03e0d5 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
@@ -24,34 +24,34 @@ class CPDF_Array : public CPDF_Object {
CPDF_Array* AsArray() override;
const CPDF_Array* AsArray() const override;
- FX_DWORD GetCount() const { return m_Objects.GetSize(); }
- CPDF_Object* GetElement(FX_DWORD index) const;
- CPDF_Object* GetElementValue(FX_DWORD index) const;
+ uint32_t GetCount() const { return m_Objects.GetSize(); }
+ CPDF_Object* GetElement(uint32_t index) const;
+ CPDF_Object* GetElementValue(uint32_t index) const;
CFX_Matrix GetMatrix();
CFX_FloatRect GetRect();
- CFX_ByteString GetStringAt(FX_DWORD index) const;
- CFX_ByteStringC GetConstStringAt(FX_DWORD index) const;
- int GetIntegerAt(FX_DWORD index) const;
- FX_FLOAT GetNumberAt(FX_DWORD index) const;
- CPDF_Dictionary* GetDictAt(FX_DWORD index) const;
- CPDF_Stream* GetStreamAt(FX_DWORD index) const;
- CPDF_Array* GetArrayAt(FX_DWORD index) const;
- FX_FLOAT GetFloatAt(FX_DWORD index) const { return GetNumberAt(index); }
+ CFX_ByteString GetStringAt(uint32_t index) const;
+ CFX_ByteStringC GetConstStringAt(uint32_t index) const;
+ int GetIntegerAt(uint32_t index) const;
+ FX_FLOAT GetNumberAt(uint32_t index) const;
+ CPDF_Dictionary* GetDictAt(uint32_t index) const;
+ CPDF_Stream* GetStreamAt(uint32_t index) const;
+ CPDF_Array* GetArrayAt(uint32_t index) const;
+ FX_FLOAT GetFloatAt(uint32_t index) const { return GetNumberAt(index); }
- void SetAt(FX_DWORD index,
+ void SetAt(uint32_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs = nullptr);
- void InsertAt(FX_DWORD index,
+ void InsertAt(uint32_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs = nullptr);
- void RemoveAt(FX_DWORD index, int nCount = 1);
+ void RemoveAt(uint32_t index, int nCount = 1);
void Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr);
void AddNumber(FX_FLOAT f);
void AddInteger(int i);
void AddString(const CFX_ByteString& str);
void AddName(const CFX_ByteString& str);
- void AddReference(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum);
+ void AddReference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum);
void AddReference(CPDF_IndirectObjectHolder* pDoc, CPDF_Object* obj) {
AddReference(pDoc, obj->GetObjNum());
}
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
index ebc5cee90a..73eabf9368 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h
@@ -65,7 +65,7 @@ class CPDF_Dictionary : public CPDF_Object {
void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f);
void SetAtReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum);
+ uint32_t objnum);
void SetAtReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
CPDF_Object* obj) {
@@ -77,7 +77,7 @@ class CPDF_Dictionary : public CPDF_Object {
void AddReference(const CFX_ByteStringC& key,
CPDF_IndirectObjectHolder* pDoc,
- FX_DWORD objnum);
+ uint32_t objnum);
// Invalidates iterators for the element with the key |key|.
void RemoveAt(const CFX_ByteStringC& key);
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
index 21b9d250fd..bbccf59361 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h
@@ -50,8 +50,8 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
int GetPageCount() const;
CPDF_Dictionary* GetPage(int iPage);
- int GetPageIndex(FX_DWORD objnum);
- FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const;
+ int GetPageIndex(uint32_t objnum);
+ uint32_t GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const;
CPDF_DocPageData* GetPageData() { return GetValidatePageData(); }
void ClearPageData();
void RemoveColorSpaceFromPageData(CPDF_Object* pObject);
@@ -60,7 +60,7 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
void ClearRenderData();
void ClearRenderFont();
- FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const;
+ FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm) const;
// |pFontDict| must not be null.
CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict);
@@ -110,8 +110,8 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
int nPagesToGo,
int level);
int _FindPageIndex(CPDF_Dictionary* pNode,
- FX_DWORD& skip_count,
- FX_DWORD objnum,
+ uint32_t& skip_count,
+ uint32_t objnum,
int& index,
int level = 0);
FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting);
@@ -127,9 +127,9 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
CFX_ByteString m_ID1;
CFX_ByteString m_ID2;
FX_BOOL m_bLinearized;
- FX_DWORD m_dwFirstPageNo;
- FX_DWORD m_dwFirstPageObjNum;
- CFX_ArrayTemplate<FX_DWORD> m_PageList;
+ uint32_t m_dwFirstPageNo;
+ uint32_t m_dwFirstPageObjNum;
+ CFX_ArrayTemplate<uint32_t> m_PageList;
CPDF_DocPageData* m_pDocPage;
CPDF_DocRenderData* m_pDocRender;
};
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
index 373159d060..a219181179 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h
@@ -16,20 +16,20 @@ class CPDF_Parser;
class CPDF_IndirectObjectHolder {
public:
- using iterator = std::map<FX_DWORD, CPDF_Object*>::iterator;
- using const_iterator = std::map<FX_DWORD, CPDF_Object*>::const_iterator;
+ using iterator = std::map<uint32_t, CPDF_Object*>::iterator;
+ using const_iterator = std::map<uint32_t, CPDF_Object*>::const_iterator;
explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser);
~CPDF_IndirectObjectHolder();
- CPDF_Object* GetIndirectObject(FX_DWORD objnum);
- FX_DWORD AddIndirectObject(CPDF_Object* pObj);
- void ReleaseIndirectObject(FX_DWORD objnum);
+ CPDF_Object* GetIndirectObject(uint32_t objnum);
+ uint32_t AddIndirectObject(CPDF_Object* pObj);
+ void ReleaseIndirectObject(uint32_t objnum);
// Takes ownership of |pObj|.
- FX_BOOL InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj);
+ FX_BOOL InsertIndirectObject(uint32_t objnum, CPDF_Object* pObj);
- FX_DWORD GetLastObjNum() const { return m_LastObjNum; }
+ uint32_t GetLastObjNum() const { return m_LastObjNum; }
iterator begin() { return m_IndirectObjs.begin(); }
const_iterator begin() const { return m_IndirectObjs.begin(); }
iterator end() { return m_IndirectObjs.end(); }
@@ -37,8 +37,8 @@ class CPDF_IndirectObjectHolder {
protected:
CPDF_Parser* m_pParser;
- FX_DWORD m_LastObjNum;
- std::map<FX_DWORD, CPDF_Object*> m_IndirectObjs;
+ uint32_t m_LastObjNum;
+ std::map<uint32_t, CPDF_Object*> m_IndirectObjs;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
index cc461d6218..1ba38a946e 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
@@ -35,8 +35,8 @@ class CPDF_Object {
};
virtual Type GetType() const = 0;
- FX_DWORD GetObjNum() const { return m_ObjNum; }
- FX_DWORD GetGenNum() const { return m_GenNum; }
+ uint32_t GetObjNum() const { return m_ObjNum; }
+ uint32_t GetGenNum() const { return m_GenNum; }
virtual CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const = 0;
virtual CPDF_Object* GetDirect() const;
@@ -85,8 +85,8 @@ class CPDF_Object {
virtual ~CPDF_Object();
void Destroy() { delete this; }
- FX_DWORD m_ObjNum;
- FX_DWORD m_GenNum;
+ uint32_t m_ObjNum;
+ uint32_t m_GenNum;
friend class CPDF_IndirectObjectHolder;
friend class CPDF_Parser;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h
index 933ab1c7fa..45aca8f21a 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h
@@ -38,7 +38,7 @@ class CPDF_Parser {
~CPDF_Parser();
Error StartParse(IFX_FileRead* pFile);
- FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE);
+ uint32_t GetPermissions(FX_BOOL bCheckRevision = FALSE);
void SetPassword(const FX_CHAR* password) { m_Password = password; }
CFX_ByteString GetPassword() { return m_Password; }
@@ -46,46 +46,46 @@ class CPDF_Parser {
FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
CPDF_Document* GetDocument() const { return m_pDocument; }
- FX_DWORD GetRootObjNum();
- FX_DWORD GetInfoObjNum();
+ uint32_t GetRootObjNum();
+ uint32_t GetInfoObjNum();
CPDF_Array* GetIDArray();
CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; }
CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList,
- FX_DWORD objnum);
+ uint32_t objnum);
- FX_DWORD GetLastObjNum() const;
- bool IsValidObjectNumber(FX_DWORD objnum) const;
- FX_FILESIZE GetObjectPositionOrZero(FX_DWORD objnum) const;
- uint8_t GetObjectType(FX_DWORD objnum) const;
- uint16_t GetObjectGenNum(FX_DWORD objnum) const;
+ uint32_t GetLastObjNum() const;
+ bool IsValidObjectNumber(uint32_t objnum) const;
+ FX_FILESIZE GetObjectPositionOrZero(uint32_t objnum) const;
+ uint8_t GetObjectType(uint32_t objnum) const;
+ uint16_t GetObjectGenNum(uint32_t objnum) const;
bool IsVersionUpdated() const { return m_bVersionUpdated; }
- bool IsObjectFreeOrNull(FX_DWORD objnum) const;
- FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm);
+ bool IsObjectFreeOrNull(uint32_t objnum) const;
+ FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm);
IPDF_CryptoHandler* GetCryptoHandler();
IFX_FileRead* GetFileAccess() const;
- FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const;
- FX_FILESIZE GetObjectSize(FX_DWORD objnum) const;
+ FX_FILESIZE GetObjectOffset(uint32_t objnum) const;
+ FX_FILESIZE GetObjectSize(uint32_t objnum) const;
- void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size);
+ void GetIndirectBinary(uint32_t objnum, uint8_t*& pBuffer, uint32_t& size);
int GetFileVersion() const { return m_FileVersion; }
FX_BOOL IsXRefStream() const { return m_bXRefStream; }
CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum);
+ uint32_t objnum);
CPDF_Object* ParseIndirectObjectAtByStrict(
CPDF_IndirectObjectHolder* pObjList,
FX_FILESIZE pos,
- FX_DWORD objnum,
+ uint32_t objnum,
FX_FILESIZE* pResultPos);
Error StartAsyncParse(IFX_FileRead* pFile);
- FX_DWORD GetFirstPageNo() const { return m_dwFirstPageNo; }
+ uint32_t GetFirstPageNo() const { return m_dwFirstPageNo; }
protected:
struct ObjectInfo {
@@ -106,14 +106,14 @@ class CPDF_Parser {
FX_BOOL RebuildCrossRef();
Error SetEncryptHandler();
void ReleaseEncryptHandler();
- FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount);
- FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount);
+ FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
+ FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, uint32_t dwObjCount);
FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos);
Error LoadLinearizedMainXRefTable();
- CPDF_StreamAcc* GetObjectStream(FX_DWORD number);
- FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset);
+ CPDF_StreamAcc* GetObjectStream(uint32_t number);
+ FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, uint32_t offset);
void SetEncryptDictionary(CPDF_Dictionary* pDict);
- void ShrinkObjectMap(FX_DWORD size);
+ void ShrinkObjectMap(uint32_t size);
CPDF_Document* m_pDocument;
std::unique_ptr<CPDF_SyntaxParser> m_pSyntax;
@@ -127,27 +127,27 @@ class CPDF_Parser {
CFX_ByteString m_bsRecipient;
CFX_ByteString m_FilePath;
CFX_ByteString m_Password;
- std::map<FX_DWORD, ObjectInfo> m_ObjectInfo;
+ std::map<uint32_t, ObjectInfo> m_ObjectInfo;
std::set<FX_FILESIZE> m_SortedOffset;
CFX_ArrayTemplate<CPDF_Dictionary*> m_Trailers;
bool m_bVersionUpdated;
CPDF_Object* m_pLinearized;
- FX_DWORD m_dwFirstPageNo;
- FX_DWORD m_dwXrefStartObjNum;
+ uint32_t m_dwFirstPageNo;
+ uint32_t m_dwXrefStartObjNum;
// A map of object numbers to indirect streams. Map owns the streams.
- std::map<FX_DWORD, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap;
+ std::map<uint32_t, std::unique_ptr<CPDF_StreamAcc>> m_ObjectStreamMap;
// Mapping of object numbers to offsets. The offsets are relative to the first
// object in the stream.
- using StreamObjectCache = std::map<FX_DWORD, FX_DWORD>;
+ using StreamObjectCache = std::map<uint32_t, uint32_t>;
// Mapping of streams to their object caches. This is valid as long as the
// streams in |m_ObjectStreamMap| are valid.
std::map<CPDF_StreamAcc*, StreamObjectCache> m_ObjCache;
// All indirect object numbers that are being parsed.
- std::set<FX_DWORD> m_ParsingObjNums;
+ std::set<uint32_t> m_ParsingObjNums;
friend class CPDF_DataAvail;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h
index f44f1e437b..b7d826902b 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h
@@ -31,9 +31,9 @@ class CPDF_Reference : public CPDF_Object {
const CPDF_Reference* AsReference() const override;
CPDF_IndirectObjectHolder* GetObjList() const { return m_pObjList; }
- FX_DWORD GetRefObjNum() const { return m_RefObjNum; }
+ uint32_t GetRefObjNum() const { return m_RefObjNum; }
- void SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum);
+ void SetRef(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum);
protected:
~CPDF_Reference() override;
@@ -45,7 +45,7 @@ class CPDF_Reference : public CPDF_Object {
}
CPDF_IndirectObjectHolder* m_pObjList;
- FX_DWORD m_RefObjNum;
+ uint32_t m_RefObjNum;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h
index 0bd3b8daac..c9aa12eaa9 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h
@@ -12,7 +12,7 @@
class CPDF_SimpleParser {
public:
- CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize);
+ CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize);
CPDF_SimpleParser(const CFX_ByteStringC& str);
CFX_ByteStringC GetWord();
@@ -22,14 +22,14 @@ class CPDF_SimpleParser {
bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams);
// For testing only.
- FX_DWORD GetCurPos() const { return m_dwCurPos; }
+ uint32_t GetCurPos() const { return m_dwCurPos; }
private:
- void ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize);
+ void ParseWord(const uint8_t*& pStart, uint32_t& dwSize);
const uint8_t* m_pData;
- FX_DWORD m_dwSize;
- FX_DWORD m_dwCurPos;
+ uint32_t m_dwSize;
+ uint32_t m_dwCurPos;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
index 20045d7aa2..0010a1528e 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h
@@ -13,7 +13,7 @@
class CPDF_Stream : public CPDF_Object {
public:
- CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict);
+ CPDF_Stream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
// CPDF_Object.
Type GetType() const override;
@@ -24,33 +24,33 @@ class CPDF_Stream : public CPDF_Object {
CPDF_Stream* AsStream() override;
const CPDF_Stream* AsStream() const override;
- FX_DWORD GetRawSize() const { return m_dwSize; }
+ uint32_t GetRawSize() const { return m_dwSize; }
uint8_t* GetRawData() const { return m_pDataBuf; }
void SetData(const uint8_t* pData,
- FX_DWORD size,
+ uint32_t size,
FX_BOOL bCompressed,
FX_BOOL bKeepBuf);
- void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict);
+ void InitStream(uint8_t* pData, uint32_t size, CPDF_Dictionary* pDict);
void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict);
FX_BOOL ReadRawData(FX_FILESIZE start_pos,
uint8_t* pBuf,
- FX_DWORD buf_size) const;
+ uint32_t buf_size) const;
bool IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; }
protected:
- static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1;
+ static const uint32_t kMemoryBasedGenNum = (uint32_t)-1;
~CPDF_Stream() override;
void InitStreamInternal(CPDF_Dictionary* pDict);
CPDF_Dictionary* m_pDict;
- FX_DWORD m_dwSize;
- FX_DWORD m_GenNum;
+ uint32_t m_dwSize;
+ uint32_t m_GenNum;
union {
uint8_t* m_pDataBuf;
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h
index 8fad265a75..6176753deb 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h
@@ -19,7 +19,7 @@ class CPDF_StreamAcc {
void LoadAllData(const CPDF_Stream* pStream,
FX_BOOL bRawAccess = FALSE,
- FX_DWORD estimated_size = 0,
+ uint32_t estimated_size = 0,
FX_BOOL bImageAcc = FALSE);
const CPDF_Stream* GetStream() const { return m_pStream; }
@@ -28,14 +28,14 @@ class CPDF_StreamAcc {
}
const uint8_t* GetData() const;
- FX_DWORD GetSize() const;
+ uint32_t GetSize() const;
const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; }
const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; }
uint8_t* DetachData();
protected:
uint8_t* m_pData;
- FX_DWORD m_dwSize;
+ uint32_t m_dwSize;
FX_BOOL m_bNewBuf;
CFX_ByteString m_ImageDecoder;
CPDF_Dictionary* m_pImageParam;
diff --git a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h
index 4a1d66cabb..1f1095b396 100644
--- a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h
+++ b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h
@@ -19,58 +19,58 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig);
CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
CFX_ByteString PDF_EncodeString(const CFX_ByteString& src,
FX_BOOL bHex = FALSE);
-CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size);
+CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1);
CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
void FlateEncode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int predictor,
int Colors,
int BitsPerComponent,
int Columns,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
-FX_DWORD FlateDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t& dest_size);
+uint32_t FlateDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
-FX_DWORD RunLengthDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t& dest_size);
+uint32_t RunLengthDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
// Public for testing.
-FX_DWORD A85Decode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t A85Decode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
// Public for testing.
-FX_DWORD HexDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+uint32_t HexDecode(const uint8_t* src_buf,
+ uint32_t src_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
// Public for testing.
-FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
+uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CPDF_Dictionary* pParams,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
uint8_t*& dest_buf,
- FX_DWORD& dest_size);
+ uint32_t& dest_size);
FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
const CPDF_Dictionary* pDict,
uint8_t*& dest_buf,
- FX_DWORD& dest_size,
+ uint32_t& dest_size,
CFX_ByteString& ImageEncoding,
CPDF_Dictionary*& pImageParms,
- FX_DWORD estimated_size,
+ uint32_t estimated_size,
FX_BOOL bImageAcc);
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_
diff --git a/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h
index d92c06d0cd..e34761ae78 100644
--- a/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h
+++ b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h
@@ -46,13 +46,13 @@ class IPDF_DataAvail {
class FileAvail {
public:
virtual ~FileAvail();
- virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) = 0;
+ virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0;
};
class DownloadHints {
public:
virtual ~DownloadHints();
- virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) = 0;
+ virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0;
};
static IPDF_DataAvail* Create(FileAvail* pFileAvail, IFX_FileRead* pFileRead);
@@ -68,7 +68,7 @@ class IPDF_DataAvail {
virtual DocFormStatus IsFormAvail(DownloadHints* pHints) = 0;
virtual DocLinearizationStatus IsLinearizedPDF() = 0;
virtual void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos,
- FX_DWORD* pSize) = 0;
+ uint32_t* pSize) = 0;
protected:
IPDF_DataAvail(FileAvail* pFileAvail, IFX_FileRead* pFileRead);
diff --git a/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h
index 8e83589a16..ea45a6b9cc 100644
--- a/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h
+++ b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h
@@ -19,27 +19,27 @@ class IPDF_CryptoHandler {
virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict,
IPDF_SecurityHandler* pSecurityHandler) = 0;
- virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0;
- virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0;
+ virtual uint32_t DecryptGetSize(uint32_t src_size) = 0;
+ virtual void* DecryptStart(uint32_t objnum, uint32_t gennum) = 0;
virtual FX_BOOL DecryptStream(void* context,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
CFX_BinaryBuf& dest_buf) = 0;
virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) = 0;
- virtual FX_DWORD EncryptGetSize(FX_DWORD objnum,
- FX_DWORD version,
+ virtual uint32_t EncryptGetSize(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size) = 0;
+ uint32_t src_size) = 0;
- virtual FX_BOOL EncryptContent(FX_DWORD objnum,
- FX_DWORD version,
+ virtual FX_BOOL EncryptContent(uint32_t objnum,
+ uint32_t version,
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
uint8_t* dest_buf,
- FX_DWORD& dest_size) = 0;
+ uint32_t& dest_size) = 0;
- void Decrypt(FX_DWORD objnum, FX_DWORD version, CFX_ByteString& str);
+ void Decrypt(uint32_t objnum, uint32_t version, CFX_ByteString& str);
};
#endif // CORE_FPDFAPI_FPDF_PARSER_IPDF_CRYPTO_HANDLER_H_
diff --git a/core/fpdfapi/fpdf_parser/ipdf_security_handler.h b/core/fpdfapi/fpdf_parser/ipdf_security_handler.h
index fd70b1fac6..e7eb822a83 100644
--- a/core/fpdfapi/fpdf_parser/ipdf_security_handler.h
+++ b/core/fpdfapi/fpdf_parser/ipdf_security_handler.h
@@ -24,7 +24,7 @@ class IPDF_SecurityHandler {
virtual FX_BOOL OnInit(CPDF_Parser* pParser,
CPDF_Dictionary* pEncryptDict) = 0;
- virtual FX_DWORD GetPermissions() = 0;
+ virtual uint32_t GetPermissions() = 0;
virtual FX_BOOL GetCryptInfo(int& cipher,
const uint8_t*& buffer,
int& keylen) = 0;
diff --git a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h
index 578700c30d..4e47e019b4 100644
--- a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h
+++ b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h
@@ -30,17 +30,17 @@ class CPDF_PageRenderCache {
~CPDF_PageRenderCache();
void ClearImageData();
- FX_DWORD EstimateSize();
+ uint32_t EstimateSize();
void CacheOptimization(int32_t dwLimitCacheSize);
- FX_DWORD GetTimeCount() const { return m_nTimeCount; }
- void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; }
+ uint32_t GetTimeCount() const { return m_nTimeCount; }
+ void SetTimeCount(uint32_t dwTimeCount) { m_nTimeCount = dwTimeCount; }
void GetCachedBitmap(CPDF_Stream* pStream,
CFX_DIBSource*& pBitmap,
CFX_DIBSource*& pMask,
- FX_DWORD& MatteColor,
+ uint32_t& MatteColor,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE,
CPDF_RenderStatus* pRenderStatus = NULL,
int32_t downsampleWidth = 0,
@@ -55,7 +55,7 @@ class CPDF_PageRenderCache {
FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE,
CPDF_RenderStatus* pRenderStatus = NULL,
int32_t downsampleWidth = 0,
@@ -69,8 +69,8 @@ class CPDF_PageRenderCache {
CPDF_Page* const m_pPage;
CPDF_ImageCacheEntry* m_pCurImageCacheEntry;
std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache;
- FX_DWORD m_nTimeCount;
- FX_DWORD m_nCacheSize;
+ uint32_t m_nTimeCount;
+ uint32_t m_nCacheSize;
FX_BOOL m_bCurFindCache;
};
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 24ca282322..216613cc61 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -208,7 +208,7 @@ FX_BOOL CPDF_RenderStatus::Initialize(CPDF_RenderContext* pContext,
FX_BOOL bStdCS,
CPDF_Type3Char* pType3Char,
FX_ARGB fill_color,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask) {
m_pContext = pContext;
m_pDevice = pDevice;
@@ -508,11 +508,11 @@ FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj,
if (FillType == 0 && !bStroke) {
return TRUE;
}
- FX_DWORD fill_argb = 0;
+ uint32_t fill_argb = 0;
if (FillType) {
fill_argb = GetFillArgb(pPathObj);
}
- FX_DWORD stroke_argb = 0;
+ uint32_t stroke_argb = 0;
if (bStroke) {
stroke_argb = GetStrokeArgb(pPathObj);
}
@@ -569,7 +569,7 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj,
m_InitialStates.m_ColorState;
}
FX_COLORREF rgb = pColorData->m_FillRGB;
- if (rgb == (FX_DWORD)-1) {
+ if (rgb == (uint32_t)-1) {
return 0;
}
const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState;
@@ -603,7 +603,7 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const {
m_InitialStates.m_ColorState;
}
FX_COLORREF rgb = pColorData->m_StrokeRGB;
- if (rgb == (FX_DWORD)-1) {
+ if (rgb == (uint32_t)-1) {
return 0;
}
const CPDF_GeneralStateData* pGeneralData = pObj->m_GeneralState;
@@ -847,7 +847,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
pTextMask->Clear(0);
CFX_FxgeDevice text_device;
text_device.Attach(pTextMask.get());
- for (FX_DWORD i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) {
+ for (uint32_t i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) {
CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i);
if (!textobj) {
break;
@@ -1156,7 +1156,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) {
if (pArray->GetCount() < 3)
return nullptr;
- for (FX_DWORD i = 0; i < 3; ++i) {
+ for (uint32_t i = 0; i < 3; ++i) {
pFuncs[2 - i].reset(CPDF_Function::Load(pArray->GetElementValue(i)));
if (!pFuncs[2 - i])
return nullptr;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index 15c7dcffcc..f5bc584348 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -15,7 +15,7 @@
#include "core/include/fxge/fx_ge.h"
struct CACHEINFO {
- FX_DWORD time;
+ uint32_t time;
CPDF_Stream* pStream;
};
@@ -30,7 +30,7 @@ CPDF_PageRenderCache::~CPDF_PageRenderCache() {
delete it.second;
}
void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) {
- if (m_nCacheSize <= (FX_DWORD)dwLimitCacheSize)
+ if (m_nCacheSize <= (uint32_t)dwLimitCacheSize)
return;
size_t nCount = m_ImageCache.size();
@@ -41,10 +41,10 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) {
pCACHEINFO[i++].pStream = it.second->GetStream();
}
FXSYS_qsort(pCACHEINFO, nCount, sizeof(CACHEINFO), compare);
- FX_DWORD nTimeCount = m_nTimeCount;
+ uint32_t nTimeCount = m_nTimeCount;
// Check if time value is about to roll over and reset all entries.
- // The comparision is legal because FX_DWORD is an unsigned type.
+ // The comparision is legal because uint32_t is an unsigned type.
if (nTimeCount + 1 < nTimeCount) {
for (i = 0; i < nCount; i++)
m_ImageCache[pCACHEINFO[i].pStream]->m_dwTimeCount = i;
@@ -55,7 +55,7 @@ void CPDF_PageRenderCache::CacheOptimization(int32_t dwLimitCacheSize) {
while (i + 15 < nCount)
ClearImageCacheEntry(pCACHEINFO[i++].pStream);
- while (i < nCount && m_nCacheSize > (FX_DWORD)dwLimitCacheSize)
+ while (i < nCount && m_nCacheSize > (uint32_t)dwLimitCacheSize)
ClearImageCacheEntry(pCACHEINFO[i++].pStream);
FX_Free(pCACHEINFO);
@@ -69,8 +69,8 @@ void CPDF_PageRenderCache::ClearImageCacheEntry(CPDF_Stream* pStream) {
delete it->second;
m_ImageCache.erase(it);
}
-FX_DWORD CPDF_PageRenderCache::EstimateSize() {
- FX_DWORD dwSize = 0;
+uint32_t CPDF_PageRenderCache::EstimateSize() {
+ uint32_t dwSize = 0;
for (const auto& it : m_ImageCache)
dwSize += it.second->EstimateSize();
@@ -80,9 +80,9 @@ FX_DWORD CPDF_PageRenderCache::EstimateSize() {
void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream,
CFX_DIBSource*& pBitmap,
CFX_DIBSource*& pMask,
- FX_DWORD& MatteColor,
+ uint32_t& MatteColor,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth,
@@ -109,7 +109,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream,
FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(
CPDF_Stream* pStream,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth,
@@ -197,18 +197,18 @@ void CPDF_ImageCacheEntry::ClearImageData() {
((CPDF_DIBSource*)m_pCachedBitmap)->ClearImageData();
}
}
-static FX_DWORD FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) {
+static uint32_t FPDF_ImageCache_EstimateImageSize(const CFX_DIBSource* pDIB) {
return pDIB && pDIB->GetBuffer()
- ? (FX_DWORD)pDIB->GetHeight() * pDIB->GetPitch() +
- (FX_DWORD)pDIB->GetPaletteSize() * 4
+ ? (uint32_t)pDIB->GetHeight() * pDIB->GetPitch() +
+ (uint32_t)pDIB->GetPaletteSize() * 4
: 0;
}
FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap,
CFX_DIBSource*& pMask,
- FX_DWORD& MatteColor,
+ uint32_t& MatteColor,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth,
@@ -264,7 +264,7 @@ CFX_DIBSource* CPDF_ImageCacheEntry::DetachMask() {
int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t downsampleWidth,
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index b28aee6980..ef452daa4e 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -57,7 +57,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
return;
}
} else {
- FX_DWORD fill_argb = m_Options.TranslateColor(mask_argb);
+ uint32_t fill_argb = m_Options.TranslateColor(mask_argb);
if (bitmap_alpha < 255) {
((uint8_t*)&fill_argb)[3] =
((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255;
@@ -137,7 +137,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
std::unique_ptr<CFX_DIBitmap> pBackdrop1(new CFX_DIBitmap);
pBackdrop1->Create(pBackdrop->GetWidth(), pBackdrop->GetHeight(),
FXDIB_Rgb32);
- pBackdrop1->Clear((FX_DWORD)-1);
+ pBackdrop1->Clear((uint32_t)-1);
pBackdrop1->CompositeBitmap(0, 0, pBackdrop->GetWidth(),
pBackdrop->GetHeight(), pBackdrop.get(), 0, 0);
pBackdrop = std::move(pBackdrop1);
@@ -221,7 +221,7 @@ void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf,
*dest_buf++ = m_RampG[FXARGB_G(src_argb)];
*dest_buf++ = m_RampR[FXARGB_B(src_argb)];
} else {
- FX_DWORD src_byte = *src_buf;
+ uint32_t src_byte = *src_buf;
*dest_buf++ = m_RampB[src_byte];
*dest_buf++ = m_RampG[src_byte];
*dest_buf++ = m_RampR[src_byte];
@@ -417,7 +417,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
m_Flags |= FXRENDER_IMAGE_LOSSY;
}
} else if (CPDF_Array* pArray = pFilters->AsArray()) {
- for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
+ for (uint32_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteStringC bsDecodeType = pArray->GetConstStringAt(i);
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") {
m_Flags |= FXRENDER_IMAGE_LOSSY;
@@ -494,7 +494,7 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
FX_ARGB bitmap_argb,
int bitmap_alpha,
const CFX_Matrix* pImage2Device,
- FX_DWORD flags,
+ uint32_t flags,
FX_BOOL bStdCS,
int blendType) {
m_pRenderStatus = pStatus;
@@ -788,7 +788,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() {
CFX_PathData path;
path.AppendRect(0, 0, 1, 1);
path.Transform(&m_ImageMatrix);
- FX_DWORD fill_color =
+ uint32_t fill_color =
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);
m_pRenderStatus->m_pDevice->DrawPath(&path, NULL, NULL, fill_color, 0,
FXFILL_WINDING);
@@ -868,7 +868,7 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
}
ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -925,7 +925,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj);
if (pCS) {
FX_FLOAT R, G, B;
- FX_DWORD comps = 8;
+ uint32_t comps = 8;
if (pCS->CountComponents() > comps) {
comps = pCS->CountComponents();
}
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 1ad091e7af..6ed50ead56 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -38,7 +38,7 @@ unsigned int GetBits8(const uint8_t* pData, uint64_t bitpos, size_t nbits) {
return (byte >> (8 - nbits - (bitpos % 8))) & ((1 << nbits) - 1);
}
-FX_SAFE_DWORD CalculatePitch8(FX_DWORD bpc, FX_DWORD components, int width) {
+FX_SAFE_DWORD CalculatePitch8(uint32_t bpc, uint32_t components, int width) {
FX_SAFE_DWORD pitch = bpc;
pitch *= components;
pitch *= width;
@@ -147,11 +147,11 @@ void CPDF_DIBSource::ReleaseBitmap(CFX_DIBitmap* pBitmap) const {
FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
const CPDF_Stream* pStream,
CPDF_DIBSource** ppMask,
- FX_DWORD* pMatteColor,
+ uint32_t* pMatteColor,
CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask) {
if (!pStream) {
return FALSE;
@@ -274,7 +274,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask) {
if (!pStream) {
return 0;
@@ -480,7 +480,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
int max_data = (1 << m_bpc) - 1;
CPDF_Array* pDecode = m_pDict->GetArrayBy("Decode");
if (pDecode) {
- for (FX_DWORD i = 0; i < m_nComponents; i++) {
+ for (uint32_t i = 0; i < m_nComponents; i++) {
pCompData[i].m_DecodeMin = pDecode->GetNumberAt(i * 2);
FX_FLOAT max = pDecode->GetNumberAt(i * 2 + 1);
pCompData[i].m_DecodeStep = (max - pCompData[i].m_DecodeMin) / max_data;
@@ -496,7 +496,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
}
}
} else {
- for (FX_DWORD i = 0; i < m_nComponents; i++) {
+ for (uint32_t i = 0; i < m_nComponents; i++) {
FX_FLOAT def_value;
m_pColorSpace->GetDefaultValue(i, def_value, pCompData[i].m_DecodeMin,
pCompData[i].m_DecodeStep);
@@ -514,7 +514,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
}
if (CPDF_Array* pArray = pMask->AsArray()) {
if (pArray->GetCount() >= m_nComponents * 2) {
- for (FX_DWORD i = 0; i < m_nComponents; i++) {
+ for (uint32_t i = 0; i < m_nComponents; i++) {
int min_num = pArray->GetIntegerAt(i * 2);
int max_num = pArray->GetIntegerAt(i * 2 + 1);
pCompData[i].m_ColorKeyMin = std::max(min_num, 0);
@@ -529,14 +529,14 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
const CPDF_Dictionary* pParams);
ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
const uint8_t* src_buf,
- FX_DWORD src_size,
+ uint32_t src_size,
int width,
int height,
int nComps,
@@ -552,7 +552,7 @@ int CPDF_DIBSource::CreateDecoder() {
return 0;
}
const uint8_t* src_data = m_pStreamAcc->GetData();
- FX_DWORD src_size = m_pStreamAcc->GetSize();
+ uint32_t src_size = m_pStreamAcc->GetSize();
const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam();
if (decoder == "CCITTFaxDecode") {
m_pDecoder.reset(FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width,
@@ -568,9 +568,9 @@ int CPDF_DIBSource::CreateDecoder() {
ICodec_JpegModule* pJpegModule = CPDF_ModuleMgr::Get()->GetJpegModule();
if (pJpegModule->LoadInfo(src_data, src_size, m_Width, m_Height, comps,
bpc, bTransform)) {
- if (m_nComponents != static_cast<FX_DWORD>(comps)) {
+ if (m_nComponents != static_cast<uint32_t>(comps)) {
FX_Free(m_pCompData);
- m_nComponents = static_cast<FX_DWORD>(comps);
+ m_nComponents = static_cast<uint32_t>(comps);
if (m_Family == PDFCS_LAB && m_nComponents != 3) {
m_pCompData = nullptr;
return 0;
@@ -638,9 +638,9 @@ void CPDF_DIBSource::LoadJpxBitmap() {
if (!context->decoder())
return;
- FX_DWORD width = 0;
- FX_DWORD height = 0;
- FX_DWORD components = 0;
+ uint32_t width = 0;
+ uint32_t height = 0;
+ uint32_t components = 0;
pJpxModule->GetImageInfo(context->decoder(), &width, &height, &components);
if (static_cast<int>(width) < m_Width || static_cast<int>(height) < m_Height)
return;
@@ -682,7 +682,7 @@ void CPDF_DIBSource::LoadJpxBitmap() {
}
m_pCachedBitmap->Clear(0xFFFFFFFF);
std::vector<uint8_t> output_offsets(components);
- for (FX_DWORD i = 0; i < components; ++i)
+ for (uint32_t i = 0; i < components; ++i)
output_offsets[i] = i;
if (bSwapRGB) {
output_offsets[0] = 2;
@@ -696,10 +696,10 @@ void CPDF_DIBSource::LoadJpxBitmap() {
if (m_pColorSpace && m_pColorSpace->GetFamily() == PDFCS_INDEXED &&
m_bpc < 8) {
int scale = 8 - m_bpc;
- for (FX_DWORD row = 0; row < height; ++row) {
+ for (uint32_t row = 0; row < height; ++row) {
uint8_t* scanline =
const_cast<uint8_t*>(m_pCachedBitmap->GetScanline(row));
- for (FX_DWORD col = 0; col < width; ++col) {
+ for (uint32_t col = 0; col < width; ++col) {
*scanline = (*scanline) >> scale;
++scanline;
}
@@ -708,7 +708,7 @@ void CPDF_DIBSource::LoadJpxBitmap() {
m_bpc = 8;
}
-CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) {
+CPDF_DIBSource* CPDF_DIBSource::LoadMask(uint32_t& MatteColor) {
MatteColor = 0xFFFFFFFF;
CPDF_Stream* pSoftMask = m_pDict->GetStreamBy("SMask");
if (pSoftMask) {
@@ -716,7 +716,7 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) {
if (pMatte && m_pColorSpace &&
m_pColorSpace->CountComponents() <= m_nComponents) {
std::vector<FX_FLOAT> colors(m_nComponents);
- for (FX_DWORD i = 0; i < m_nComponents; i++) {
+ for (uint32_t i = 0; i < m_nComponents; i++) {
colors[i] = pMatte->GetFloatAt(i);
}
FX_FLOAT R, G, B;
@@ -742,7 +742,7 @@ int CPDF_DIBSource::StratLoadMask() {
m_pColorSpace->CountComponents() <= m_nComponents) {
FX_FLOAT R, G, B;
std::vector<FX_FLOAT> colors(m_nComponents);
- for (FX_DWORD i = 0; i < m_nComponents; i++) {
+ for (uint32_t i = 0; i < m_nComponents; i++) {
colors[i] = pMatte->GetFloatAt(i);
}
m_pColorSpace->GetRGB(colors.data(), R, G, B);
@@ -853,7 +853,7 @@ void CPDF_DIBSource::LoadPalette() {
FX_FLOAT* color_value = color_values;
for (int i = 0; i < palette_count; i++) {
int color_data = i;
- for (FX_DWORD j = 0; j < m_nComponents; j++) {
+ for (uint32_t j = 0; j < m_nComponents; j++) {
int encoded_component = color_data % (1 << m_bpc);
color_data /= 1 << m_bpc;
color_value[j] = m_pCompData[j].m_DecodeMin +
@@ -972,7 +972,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
uint64_t src_byte_pos = 0;
size_t dest_byte_pos = 0;
for (int column = 0; column < m_Width; column++) {
- for (FX_DWORD color = 0; color < m_nComponents; color++) {
+ for (uint32_t color = 0; color < m_nComponents; color++) {
uint8_t data = src_scan[src_byte_pos++];
color_values[color] = m_pCompData[color].m_DecodeMin +
m_pCompData[color].m_DecodeStep * data;
@@ -997,7 +997,7 @@ void CPDF_DIBSource::TranslateScanline24bpp(uint8_t* dest_scan,
uint64_t src_bit_pos = 0;
size_t dest_byte_pos = 0;
for (int column = 0; column < m_Width; column++) {
- for (FX_DWORD color = 0; color < m_nComponents; color++) {
+ for (uint32_t color = 0; color < m_nComponents; color++) {
unsigned int data = GetBits8(src_scan, src_bit_pos, m_bpc);
color_values[color] = m_pCompData[color].m_DecodeMin +
m_pCompData[color].m_DecodeStep * data;
@@ -1033,7 +1033,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
FX_SAFE_DWORD src_pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width);
if (!src_pitch.IsValid())
return nullptr;
- FX_DWORD src_pitch_value = src_pitch.ValueOrDie();
+ uint32_t src_pitch_value = src_pitch.ValueOrDie();
const uint8_t* pSrcLine = nullptr;
if (m_pCachedBitmap && src_pitch_value <= m_pCachedBitmap->GetPitch()) {
if (line >= m_pCachedBitmap->GetHeight()) {
@@ -1054,11 +1054,11 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
}
if (m_bpc * m_nComponents == 1) {
if (m_bImageMask && m_bDefaultDecode) {
- for (FX_DWORD i = 0; i < src_pitch_value; i++) {
+ for (uint32_t i = 0; i < src_pitch_value; i++) {
m_pLineBuf[i] = ~pSrcLine[i];
}
} else if (m_bColorKey) {
- FX_DWORD reset_argb, set_argb;
+ uint32_t reset_argb, set_argb;
reset_argb = m_pPalette ? m_pPalette[0] : 0xFF000000;
set_argb = m_pPalette ? m_pPalette[1] : 0xFFFFFFFF;
if (m_pCompData[0].m_ColorKeyMin == 0) {
@@ -1069,7 +1069,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
}
set_argb = FXARGB_TODIB(set_argb);
reset_argb = FXARGB_TODIB(reset_argb);
- FX_DWORD* dest_scan = reinterpret_cast<FX_DWORD*>(m_pMaskedLine);
+ uint32_t* dest_scan = reinterpret_cast<uint32_t*>(m_pMaskedLine);
for (int col = 0; col < m_Width; col++) {
if (pSrcLine[col / 8] & (1 << (7 - col % 8))) {
*dest_scan = set_argb;
@@ -1091,7 +1091,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const {
uint64_t src_bit_pos = 0;
for (int col = 0; col < m_Width; col++) {
unsigned int color_index = 0;
- for (FX_DWORD color = 0; color < m_nComponents; color++) {
+ for (uint32_t color = 0; color < m_nComponents; color++) {
unsigned int data = GetBits8(pSrcLine, src_bit_pos, m_bpc);
color_index |= data << (color * m_bpc);
src_bit_pos += m_bpc;
@@ -1175,7 +1175,7 @@ void CPDF_DIBSource::DownSampleScanline(int line,
return;
}
- FX_DWORD src_width = m_Width;
+ uint32_t src_width = m_Width;
FX_SAFE_DWORD pitch = CalculatePitch8(m_bpc, m_nComponents, m_Width);
if (!pitch.IsValid())
return;
@@ -1186,7 +1186,7 @@ void CPDF_DIBSource::DownSampleScanline(int line,
} else if (m_pDecoder) {
pSrcLine = m_pDecoder->GetScanline(line);
} else {
- FX_DWORD src_pitch = pitch.ValueOrDie();
+ uint32_t src_pitch = pitch.ValueOrDie();
pitch *= (line + 1);
if (!pitch.IsValid()) {
return;
@@ -1224,19 +1224,19 @@ void CPDF_DIBSource::DownSampleScanline(int line,
void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
int dest_Bpp,
- FX_DWORD src_width,
+ uint32_t src_width,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
FX_BOOL bFlipX,
int clip_left,
int clip_width) const {
- FX_DWORD set_argb = (FX_DWORD)-1;
- FX_DWORD reset_argb = 0;
+ uint32_t set_argb = (uint32_t)-1;
+ uint32_t reset_argb = 0;
if (m_bImageMask) {
if (m_bDefaultDecode) {
set_argb = 0;
- reset_argb = (FX_DWORD)-1;
+ reset_argb = (uint32_t)-1;
}
} else if (m_bColorKey) {
reset_argb = m_pPalette ? m_pPalette[0] : 0xFF000000;
@@ -1249,9 +1249,9 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
}
set_argb = FXARGB_TODIB(set_argb);
reset_argb = FXARGB_TODIB(reset_argb);
- FX_DWORD* dest_scan_dword = reinterpret_cast<FX_DWORD*>(dest_scan);
+ uint32_t* dest_scan_dword = reinterpret_cast<uint32_t*>(dest_scan);
for (int i = 0; i < clip_width; i++) {
- FX_DWORD src_x = (clip_left + i) * src_width / dest_width;
+ uint32_t src_x = (clip_left + i) * src_width / dest_width;
if (bFlipX) {
src_x = src_width - src_x - 1;
}
@@ -1271,7 +1271,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
}
}
for (int i = 0; i < clip_width; i++) {
- FX_DWORD src_x = (clip_left + i) * src_width / dest_width;
+ uint32_t src_x = (clip_left + i) * src_width / dest_width;
if (bFlipX) {
src_x = src_width - src_x - 1;
}
@@ -1285,7 +1285,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
dest_scan[dest_pos + 1] = FXARGB_G(set_argb);
dest_scan[dest_pos + 2] = FXARGB_R(set_argb);
} else {
- *reinterpret_cast<FX_DWORD*>(dest_scan + dest_pos) = set_argb;
+ *reinterpret_cast<uint32_t*>(dest_scan + dest_pos) = set_argb;
}
} else {
if (dest_Bpp == 1) {
@@ -1295,7 +1295,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
dest_scan[dest_pos + 1] = FXARGB_G(reset_argb);
dest_scan[dest_pos + 2] = FXARGB_R(reset_argb);
} else {
- *reinterpret_cast<FX_DWORD*>(dest_scan + dest_pos) = reset_argb;
+ *reinterpret_cast<uint32_t*>(dest_scan + dest_pos) = reset_argb;
}
}
}
@@ -1303,7 +1303,7 @@ void CPDF_DIBSource::DownSampleScanline1Bit(int orig_Bpp,
void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp,
int dest_Bpp,
- FX_DWORD src_width,
+ uint32_t src_width,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
@@ -1312,9 +1312,9 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp,
int clip_width) const {
if (m_bpc < 8) {
uint64_t src_bit_pos = 0;
- for (FX_DWORD col = 0; col < src_width; col++) {
+ for (uint32_t col = 0; col < src_width; col++) {
unsigned int color_index = 0;
- for (FX_DWORD color = 0; color < m_nComponents; color++) {
+ for (uint32_t color = 0; color < m_nComponents; color++) {
unsigned int data = GetBits8(pSrcLine, src_bit_pos, m_bpc);
color_index |= data << (color * m_bpc);
src_bit_pos += m_bpc;
@@ -1325,7 +1325,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp,
}
if (m_bColorKey) {
for (int i = 0; i < clip_width; i++) {
- FX_DWORD src_x = (clip_left + i) * src_width / dest_width;
+ uint32_t src_x = (clip_left + i) * src_width / dest_width;
if (bFlipX) {
src_x = src_width - src_x - 1;
}
@@ -1349,7 +1349,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp,
return;
}
for (int i = 0; i < clip_width; i++) {
- FX_DWORD src_x = (clip_left + i) * src_width / dest_width;
+ uint32_t src_x = (clip_left + i) * src_width / dest_width;
if (bFlipX) {
src_x = src_width - src_x - 1;
}
@@ -1369,7 +1369,7 @@ void CPDF_DIBSource::DownSampleScanline8Bit(int orig_Bpp,
void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
int dest_Bpp,
- FX_DWORD src_width,
+ uint32_t src_width,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
@@ -1378,12 +1378,12 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
int clip_width) const {
// last_src_x used to store the last seen src_x position which should be
// in [0, src_width). Set the initial value to be an invalid src_x value.
- FX_DWORD last_src_x = src_width;
+ uint32_t last_src_x = src_width;
FX_ARGB last_argb = FXARGB_MAKE(0xFF, 0xFF, 0xFF, 0xFF);
FX_FLOAT unit_To8Bpc = 255.0f / ((1 << m_bpc) - 1);
for (int i = 0; i < clip_width; i++) {
int dest_x = clip_left + i;
- FX_DWORD src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) *
+ uint32_t src_x = (bFlipX ? (dest_width - dest_x - 1) : dest_x) *
(int64_t)src_width / dest_width;
src_x %= src_width;
@@ -1401,7 +1401,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
size_t num_bits = src_x * m_bpc * m_nComponents;
uint64_t src_bit_pos = num_bits % 8;
pSrcPixel = pSrcLine + num_bits / 8;
- for (FX_DWORD j = 0; j < m_nComponents; ++j) {
+ for (uint32_t j = 0; j < m_nComponents; ++j) {
extracted_components[j] = static_cast<uint8_t>(
GetBits8(pSrcPixel, src_bit_pos, m_bpc) * unit_To8Bpc);
src_bit_pos += m_bpc;
@@ -1410,7 +1410,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
} else {
pSrcPixel = pSrcLine + src_x * orig_Bpp;
if (m_bpc == 16) {
- for (FX_DWORD j = 0; j < m_nComponents; ++j)
+ for (uint32_t j = 0; j < m_nComponents; ++j)
extracted_components[j] = pSrcPixel[j * 2];
pSrcPixel = extracted_components;
}
@@ -1423,7 +1423,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
m_pColorSpace->TranslateImageLine(color, pSrcPixel, 1, 0, 0,
bTransMask);
} else {
- for (FX_DWORD j = 0; j < m_nComponents; ++j) {
+ for (uint32_t j = 0; j < m_nComponents; ++j) {
FX_FLOAT component_value =
static_cast<FX_FLOAT>(extracted_components[j]);
int color_value = static_cast<int>(
@@ -1460,7 +1460,7 @@ void CPDF_DIBSource::DownSampleScanline32Bit(int orig_Bpp,
last_argb = argb;
}
if (dest_Bpp == 4) {
- *reinterpret_cast<FX_DWORD*>(pDestPixel) = FXARGB_TODIB(argb);
+ *reinterpret_cast<uint32_t*>(pDestPixel) = FXARGB_TODIB(argb);
} else {
*pDestPixel++ = FXARGB_B(argb);
*pDestPixel++ = FXARGB_G(argb);
@@ -1500,7 +1500,7 @@ FX_BOOL CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader,
const CPDF_ImageObject* pImage,
CPDF_PageRenderCache* pCache,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t nDownsampleWidth,
@@ -1565,7 +1565,7 @@ FX_BOOL CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage,
CPDF_PageRenderCache* pCache,
CPDF_ImageLoaderHandle*& LoadHandle,
FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
+ uint32_t GroupFamily,
FX_BOOL bLoadMask,
CPDF_RenderStatus* pRenderStatus,
int32_t nDownsampleWidth,
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 94f38c5186..9c1fa36b28 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -70,7 +70,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap,
CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results);
FX_FLOAT* pResults = result_array;
FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT));
- FX_DWORD rgb_array[SHADING_STEPS];
+ uint32_t rgb_array[SHADING_STEPS];
for (int i = 0; i < SHADING_STEPS; i++) {
FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min;
int offset = 0;
@@ -90,7 +90,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap,
}
int pitch = pBitmap->GetPitch();
for (int row = 0; row < height; row++) {
- FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch);
+ uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch);
for (int column = 0; column < width; column++) {
FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row;
matrix.Transform(x, y);
@@ -156,7 +156,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
CFX_FixedBufGrow<FX_FLOAT, 16> result_array(total_results);
FX_FLOAT* pResults = result_array;
FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT));
- FX_DWORD rgb_array[SHADING_STEPS];
+ uint32_t rgb_array[SHADING_STEPS];
for (int i = 0; i < SHADING_STEPS; i++) {
FX_FLOAT input = (t_max - t_min) * i / SHADING_STEPS + t_min;
int offset = 0;
@@ -189,7 +189,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
}
}
for (int row = 0; row < height; row++) {
- FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch);
+ uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch);
for (int column = 0; column < width; column++) {
FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row;
matrix.Transform(x, y);
@@ -286,7 +286,7 @@ static void DrawFuncShading(CFX_DIBitmap* pBitmap,
FX_FLOAT* pResults = result_array;
FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT));
for (int row = 0; row < height; row++) {
- FX_DWORD* dib_buf = (FX_DWORD*)(pBitmap->GetBuffer() + row * pitch);
+ uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch);
for (int column = 0; column < width; column++) {
FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row;
matrix.Transform(x, y);
@@ -432,7 +432,7 @@ static void DrawFreeGouraudShading(CFX_DIBitmap* pBitmap,
while (!stream.m_BitStream.IsEOF()) {
CPDF_MeshVertex vertex;
- FX_DWORD flag = stream.GetVertex(vertex, pObject2Bitmap);
+ uint32_t flag = stream.GetVertex(vertex, pObject2Bitmap);
if (flag == 0) {
triangle[0] = vertex;
for (int j = 1; j < 3; j++) {
@@ -782,7 +782,7 @@ static void DrawCoonPatchMeshes(FX_BOOL bTensor,
CFX_PointF coords[16];
int point_count = bTensor ? 16 : 12;
while (!stream.m_BitStream.IsEOF()) {
- FX_DWORD flag = stream.GetFlag();
+ uint32_t flag = stream.GetFlag();
int iStartPoint = 0, iStartColor = 0, i = 0;
if (flag) {
iStartPoint = 4;
@@ -1141,7 +1141,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
return;
}
screen.Clear(0);
- FX_DWORD* src_buf = (FX_DWORD*)pPatternBitmap->GetBuffer();
+ uint32_t* src_buf = (uint32_t*)pPatternBitmap->GetBuffer();
for (int col = min_col; col <= max_col; col++) {
for (int row = min_row; row <= max_row; row++) {
int start_x, start_y;
@@ -1160,8 +1160,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
start_y >= clip_box.Height()) {
continue;
}
- FX_DWORD* dest_buf =
- (FX_DWORD*)(screen.GetBuffer() + screen.GetPitch() * start_y +
+ uint32_t* dest_buf =
+ (uint32_t*)(screen.GetBuffer() + screen.GetPitch() * start_y +
start_x * 4);
if (pPattern->m_bColored) {
*dest_buf = *src_buf;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 04b0c93507..c38362fb70 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -29,7 +29,7 @@ CPDF_Type3Cache::~CPDF_Type3Cache() {
}
m_SizeMap.clear();
}
-CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode,
+CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode,
const CFX_Matrix* pMatrix,
FX_FLOAT retinaScaleX,
FX_FLOAT retinaScaleY) {
@@ -130,7 +130,7 @@ static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) {
return -1;
}
CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize,
- FX_DWORD charcode,
+ uint32_t charcode,
const CFX_Matrix* pMatrix,
FX_FLOAT retinaScaleX,
FX_FLOAT retinaScaleY) {
@@ -192,10 +192,10 @@ void _CPDF_UniqueKeyGen::Generate(int count, ...) {
va_start(argList, count);
for (int i = 0; i < count; i++) {
int p = va_arg(argList, int);
- ((FX_DWORD*)m_Key)[i] = p;
+ ((uint32_t*)m_Key)[i] = p;
}
va_end(argList);
- m_KeyLen = count * sizeof(FX_DWORD);
+ m_KeyLen = count * sizeof(uint32_t);
}
FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj,
const CFX_Matrix* pObj2Device,
@@ -334,7 +334,7 @@ class CPDF_RefType3Cache {
ReleaseCachedType3(m_pType3Font);
}
}
- FX_DWORD m_dwCount;
+ uint32_t m_dwCount;
CPDF_Type3Font* m_pType3Font;
};
FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
@@ -362,13 +362,13 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
return FALSE;
}
CPDF_RefType3Cache refTypeCache(pType3Font);
- FX_DWORD* pChars = textobj->m_pCharCodes;
+ uint32_t* pChars = textobj->m_pCharCodes;
if (textobj->m_nChars == 1) {
- pChars = (FX_DWORD*)(&textobj->m_pCharCodes);
+ pChars = (uint32_t*)(&textobj->m_pCharCodes);
}
for (int iChar = 0; iChar < textobj->m_nChars; iChar++) {
- FX_DWORD charcode = pChars[iChar];
- if (charcode == (FX_DWORD)-1) {
+ uint32_t charcode = pChars[iChar];
+ if (charcode == (uint32_t)-1) {
continue;
}
CPDF_Type3Char* pType3Char = pType3Font->LoadChar(charcode);
@@ -501,12 +501,12 @@ class CPDF_CharPosList {
CPDF_CharPosList();
~CPDF_CharPosList();
void Load(int nChars,
- FX_DWORD* pCharCodes,
+ uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
CPDF_Font* pFont,
FX_FLOAT font_size);
FXTEXT_CHARPOS* m_pCharPos;
- FX_DWORD m_nChars;
+ uint32_t m_nChars;
};
CPDF_CharPosList::CPDF_CharPosList() {
@@ -516,7 +516,7 @@ CPDF_CharPosList::~CPDF_CharPosList() {
FX_Free(m_pCharPos);
}
void CPDF_CharPosList::Load(int nChars,
- FX_DWORD* pCharCodes,
+ uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
CPDF_Font* pFont,
FX_FLOAT FontSize) {
@@ -525,9 +525,9 @@ void CPDF_CharPosList::Load(int nChars,
CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting();
for (int iChar = 0; iChar < nChars; iChar++) {
- FX_DWORD CharCode =
- nChars == 1 ? (FX_DWORD)(uintptr_t)pCharCodes : pCharCodes[iChar];
- if (CharCode == (FX_DWORD)-1) {
+ uint32_t CharCode =
+ nChars == 1 ? (uint32_t)(uintptr_t)pCharCodes : pCharCodes[iChar];
+ if (CharCode == (uint32_t)-1) {
continue;
}
FX_BOOL bVert = FALSE;
@@ -575,7 +575,7 @@ void CPDF_CharPosList::Load(int nChars,
}
FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
int nChars,
- FX_DWORD* pCharCodes,
+ uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
CPDF_Font* pFont,
FX_FLOAT font_size,
@@ -629,16 +629,16 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
if (nChars == 0) {
return;
}
- FX_DWORD charcode;
+ uint32_t charcode;
int offset = 0;
- FX_DWORD* pCharCodes;
+ uint32_t* pCharCodes;
FX_FLOAT* pCharPos;
if (nChars == 1) {
charcode = pFont->GetNextChar(str, str.GetLength(), offset);
- pCharCodes = (FX_DWORD*)(uintptr_t)charcode;
+ pCharCodes = (uint32_t*)(uintptr_t)charcode;
pCharPos = NULL;
} else {
- pCharCodes = FX_Alloc(FX_DWORD, nChars);
+ pCharCodes = FX_Alloc(uint32_t, nChars);
pCharPos = FX_Alloc(FX_FLOAT, nChars - 1);
FX_FLOAT cur_pos = 0;
for (int i = 0; i < nChars; i++) {
@@ -673,7 +673,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
}
FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
int nChars,
- FX_DWORD* pCharCodes,
+ uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
CPDF_Font* pFont,
FX_FLOAT font_size,
@@ -687,7 +687,7 @@ FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size);
int FXGE_flags = 0;
if (pOptions) {
- FX_DWORD dwFlags = pOptions->m_Flags;
+ uint32_t dwFlags = pOptions->m_Flags;
if (dwFlags & RENDER_CLEARTYPE) {
FXGE_flags |= FXTEXT_CLEARTYPE;
if (dwFlags & RENDER_BGR_STRIPE) {
@@ -750,7 +750,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
CPDF_CharPosList CharPosList;
CharPosList.Load(textobj->m_nChars, textobj->m_pCharCodes,
textobj->m_pCharPos, pFont, font_size);
- for (FX_DWORD i = 0; i < CharPosList.m_nChars; i++) {
+ for (uint32_t i = 0; i < CharPosList.m_nChars; i++) {
FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i];
const CFX_PathData* pPath = pFaceCache->LoadGlyphPath(
&pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth);
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
index 11ece71406..96e30412d5 100644
--- a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
+++ b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
@@ -54,7 +54,7 @@ class CPDF_ProgressiveRenderer {
const CPDF_RenderOptions* const m_pOptions;
std::unique_ptr<CPDF_RenderStatus> m_pRenderStatus;
CFX_FloatRect m_ClipRect;
- FX_DWORD m_LayerIndex;
+ uint32_t m_LayerIndex;
CPDF_RenderContext::Layer* m_pCurrentLayer;
CPDF_PageObjectList::iterator m_LastObjectRendered;
};
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h
index b2566ad007..2974a658b4 100644
--- a/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h
+++ b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h
@@ -50,8 +50,8 @@ class CPDF_RenderContext {
const CPDF_RenderOptions* pOptions,
CFX_Matrix* pFinalMatrix);
- FX_DWORD CountLayers() const { return m_Layers.GetSize(); }
- Layer* GetLayer(FX_DWORD index) { return m_Layers.GetDataPtr(index); }
+ uint32_t CountLayers() const { return m_Layers.GetSize(); }
+ Layer* GetLayer(uint32_t index) { return m_Layers.GetDataPtr(index); }
CPDF_Document* GetDocument() const { return m_pDocument; }
CPDF_Dictionary* GetPageResources() const { return m_pPageResources; }
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
index f28fae4f3d..a78838ac58 100644
--- a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
+++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
@@ -41,11 +41,11 @@ class CPDF_RenderOptions {
int m_ColorMode;
FX_COLORREF m_BackColor;
FX_COLORREF m_ForeColor;
- FX_DWORD m_Flags;
+ uint32_t m_Flags;
int m_Interpolation;
- FX_DWORD m_AddFlags;
+ uint32_t m_AddFlags;
IPDF_OCContext* m_pOCContext;
- FX_DWORD m_dwLimitCacheSize;
+ uint32_t m_dwLimitCacheSize;
int m_HalftoneLimit;
};
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
index 7c04e4a705..2d3ce44e46 100644
--- a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
+++ b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
@@ -42,7 +42,7 @@ class CPDF_TextRenderer {
static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice,
int nChars,
- FX_DWORD* pCharCodes,
+ uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
CPDF_Font* pFont,
FX_FLOAT font_size,
@@ -56,7 +56,7 @@ class CPDF_TextRenderer {
static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice,
int nChars,
- FX_DWORD* pCharCodes,
+ uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
CPDF_Font* pFont,
FX_FLOAT font_size,
@@ -66,7 +66,7 @@ class CPDF_TextRenderer {
static FX_BOOL DrawType3Text(CFX_RenderDevice* pDevice,
int nChars,
- FX_DWORD* pCharCodes,
+ uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
CPDF_Font* pFont,
FX_FLOAT font_size,
diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h
index ea1b1d8f6b..a3b8d76fe7 100644
--- a/core/fpdfapi/fpdf_render/render_int.h
+++ b/core/fpdfapi/fpdf_render/render_int.h
@@ -56,7 +56,7 @@ class CPDF_Type3Glyphs {
int& top_line,
int& bottom_line);
- std::map<FX_DWORD, CFX_GlyphBitmap*> m_GlyphMap;
+ std::map<uint32_t, CFX_GlyphBitmap*> m_GlyphMap;
int m_TopBlue[TYPE3_MAX_BLUES];
int m_BottomBlue[TYPE3_MAX_BLUES];
int m_TopBlueCount;
@@ -67,14 +67,14 @@ class CPDF_Type3Cache {
explicit CPDF_Type3Cache(CPDF_Type3Font* pFont) : m_pFont(pFont) {}
~CPDF_Type3Cache();
- CFX_GlyphBitmap* LoadGlyph(FX_DWORD charcode,
+ CFX_GlyphBitmap* LoadGlyph(uint32_t charcode,
const CFX_Matrix* pMatrix,
FX_FLOAT retinaScaleX = 1.0f,
FX_FLOAT retinaScaleY = 1.0f);
protected:
CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize,
- FX_DWORD charcode,
+ uint32_t charcode,
const CFX_Matrix* pMatrix,
FX_FLOAT retinaScaleX = 1.0f,
FX_FLOAT retinaScaleY = 1.0f);
@@ -148,7 +148,7 @@ class CPDF_RenderStatus {
FX_BOOL bStdCS = FALSE,
CPDF_Type3Char* pType3Char = NULL,
FX_ARGB fill_color = 0,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE);
void RenderObjectList(const CPDF_PageObjectHolder* pObjectHolder,
const CFX_Matrix* pObj2Device);
@@ -209,7 +209,7 @@ class CPDF_RenderStatus {
int bitmap_alpha,
const CFX_Matrix* pImage2Device,
CPDF_ImageCacheEntry* pImageCache,
- FX_DWORD flags);
+ uint32_t flags);
void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
int left,
int top,
@@ -281,7 +281,7 @@ class CPDF_RenderStatus {
int m_DitherBits;
FX_BOOL m_bDropObjects;
FX_BOOL m_bStdCS;
- FX_DWORD m_GroupFamily;
+ uint32_t m_GroupFamily;
FX_BOOL m_bLoadMask;
CPDF_Type3Char* m_pType3Char;
FX_ARGB m_T3FillColor;
@@ -302,7 +302,7 @@ class CPDF_ImageLoader {
CPDF_PageRenderCache* pCache,
CPDF_ImageLoaderHandle*& LoadHandle,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE,
CPDF_RenderStatus* pRenderStatus = NULL,
int32_t nDownsampleWidth = 0,
@@ -311,7 +311,7 @@ class CPDF_ImageLoader {
CFX_DIBSource* m_pBitmap;
CFX_DIBSource* m_pMask;
- FX_DWORD m_MatteColor;
+ uint32_t m_MatteColor;
FX_BOOL m_bCached;
protected:
@@ -327,7 +327,7 @@ class CPDF_ImageLoaderHandle {
const CPDF_ImageObject* pImage,
CPDF_PageRenderCache* pCache,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE,
CPDF_RenderStatus* pRenderStatus = NULL,
int32_t nDownsampleWidth = 0,
@@ -360,7 +360,7 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer {
FX_ARGB bitmap_argb,
int bitmap_alpha,
const CFX_Matrix* pImage2Device,
- FX_DWORD flags,
+ uint32_t flags,
FX_BOOL bStdCS,
int blendType = FXDIB_BLEND_NORMAL);
@@ -377,7 +377,7 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer {
FX_BOOL m_bPatternColor;
CPDF_Pattern* m_pPattern;
FX_ARGB m_FillArgb;
- FX_DWORD m_Flags;
+ uint32_t m_Flags;
CFX_ImageTransformer* m_pTransformer;
void* m_DeviceHandle;
CPDF_ImageLoaderHandle* m_LoadHandle;
@@ -447,25 +447,25 @@ class CPDF_ImageCacheEntry {
void Reset(const CFX_DIBitmap* pBitmap);
FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap,
CFX_DIBSource*& pMask,
- FX_DWORD& MatteColor,
+ uint32_t& MatteColor,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE,
CPDF_RenderStatus* pRenderStatus = NULL,
int32_t downsampleWidth = 0,
int32_t downsampleHeight = 0);
- FX_DWORD EstimateSize() const { return m_dwCacheSize; }
- FX_DWORD GetTimeCount() const { return m_dwTimeCount; }
+ uint32_t EstimateSize() const { return m_dwCacheSize; }
+ uint32_t GetTimeCount() const { return m_dwTimeCount; }
CPDF_Stream* GetStream() const { return m_pStream; }
- void SetTimeCount(FX_DWORD dwTimeCount) { m_dwTimeCount = dwTimeCount; }
+ void SetTimeCount(uint32_t dwTimeCount) { m_dwTimeCount = dwTimeCount; }
int m_dwTimeCount;
public:
int StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE,
CPDF_RenderStatus* pRenderStatus = NULL,
int32_t downsampleWidth = 0,
@@ -475,7 +475,7 @@ class CPDF_ImageCacheEntry {
CFX_DIBSource* DetachMask();
CFX_DIBSource* m_pCurBitmap;
CFX_DIBSource* m_pCurMask;
- FX_DWORD m_MatteColor;
+ uint32_t m_MatteColor;
CPDF_RenderStatus* m_pRenderStatus;
protected:
@@ -485,7 +485,7 @@ class CPDF_ImageCacheEntry {
CPDF_Stream* m_pStream;
CFX_DIBSource* m_pCachedBitmap;
CFX_DIBSource* m_pCachedMask;
- FX_DWORD m_dwCacheSize;
+ uint32_t m_dwCacheSize;
void CalcSize();
};
typedef struct {
@@ -503,11 +503,11 @@ class CPDF_DIBSource : public CFX_DIBSource {
FX_BOOL Load(CPDF_Document* pDoc,
const CPDF_Stream* pStream,
CPDF_DIBSource** ppMask,
- FX_DWORD* pMatteColor,
+ uint32_t* pMatteColor,
CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE);
// CFX_DIBSource
@@ -526,7 +526,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
CFX_DIBitmap* GetBitmap() const;
void ReleaseBitmap(CFX_DIBitmap* pBitmap) const;
void ClearImageData();
- FX_DWORD GetMatteColor() const { return m_MatteColor; }
+ uint32_t GetMatteColor() const { return m_MatteColor; }
int StartLoadDIBSource(CPDF_Document* pDoc,
const CPDF_Stream* pStream,
@@ -534,7 +534,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
CPDF_Dictionary* pFormResources,
CPDF_Dictionary* pPageResources,
FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
+ uint32_t GroupFamily = 0,
FX_BOOL bLoadMask = FALSE);
int ContinueLoadDIBSource(IFX_Pause* pPause);
int StratLoadMask();
@@ -548,7 +548,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
const CPDF_Dictionary* pPageResources);
DIB_COMP_DATA* GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
FX_BOOL& bColorKey);
- CPDF_DIBSource* LoadMask(FX_DWORD& MatteColor);
+ CPDF_DIBSource* LoadMask(uint32_t& MatteColor);
CPDF_DIBSource* LoadMaskDIB(CPDF_Stream* pMask);
void LoadJpxBitmap();
void LoadPalette();
@@ -558,7 +558,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
void ValidateDictParam();
void DownSampleScanline1Bit(int orig_Bpp,
int dest_Bpp,
- FX_DWORD src_width,
+ uint32_t src_width,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
@@ -567,7 +567,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
int clip_width) const;
void DownSampleScanline8Bit(int orig_Bpp,
int dest_Bpp,
- FX_DWORD src_width,
+ uint32_t src_width,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
@@ -576,7 +576,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
int clip_width) const;
void DownSampleScanline32Bit(int orig_Bpp,
int dest_Bpp,
- FX_DWORD src_width,
+ uint32_t src_width,
const uint8_t* pSrcLine,
uint8_t* dest_scan,
int dest_width,
@@ -590,12 +590,12 @@ class CPDF_DIBSource : public CFX_DIBSource {
std::unique_ptr<CPDF_StreamAcc> m_pStreamAcc;
const CPDF_Dictionary* m_pDict;
CPDF_ColorSpace* m_pColorSpace;
- FX_DWORD m_Family;
- FX_DWORD m_bpc;
- FX_DWORD m_bpc_orig;
- FX_DWORD m_nComponents;
- FX_DWORD m_GroupFamily;
- FX_DWORD m_MatteColor;
+ uint32_t m_Family;
+ uint32_t m_bpc;
+ uint32_t m_bpc_orig;
+ uint32_t m_nComponents;
+ uint32_t m_GroupFamily;
+ uint32_t m_MatteColor;
FX_BOOL m_bLoadMask;
FX_BOOL m_bDefaultDecode;
FX_BOOL m_bImageMask;