diff options
author | tsepez <tsepez@chromium.org> | 2016-03-25 15:18:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 15:18:36 -0700 |
commit | b5e8f14e3eefc5da995b332788d3203cee204883 (patch) | |
tree | 34fc80504d2034013b18f30df1b0f6f1a94e2d70 /core/fpdfapi/fpdf_edit | |
parent | 6d18bd3b8ec82ae3c24a439f5c7925786a0e2d8b (diff) | |
download | pdfium-b5e8f14e3eefc5da995b332788d3203cee204883.tar.xz |
Remove FX_DWORD from core/ and delete definitionchromium/2695chromium/2694chromium/2693chromium/2692
Review URL: https://codereview.chromium.org/1832173003
Diffstat (limited to 'core/fpdfapi/fpdf_edit')
-rw-r--r-- | core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_edit/editint.h | 26 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 148 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 14 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_edit/include/cpdf_creator.h | 28 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h | 2 |
6 files changed, 111 insertions, 111 deletions
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); |