From bba6b77b6b35da6b5884248d768f12615f62a003 Mon Sep 17 00:00:00 2001 From: Artem Strygin Date: Thu, 20 Jul 2017 21:38:39 +0300 Subject: Use enum for pdf object type Replace uint8_t type to enum for ObjectType variables Change-Id: Ie33c8c9413c5082397a2c6fbf73e03f08b7d8658 Reviewed-on: https://pdfium-review.googlesource.com/8470 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fpdfapi/edit/cpdf_creator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/fpdfapi/edit') diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index 858d56cbaf..ceffa5077f 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp @@ -323,9 +323,9 @@ bool CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) { m_ObjectOffsets[objnum] = m_Archive->CurrentOffset(); bool bExistInMap = !!m_pDocument->GetIndirectObject(objnum); - const uint8_t object_type = m_pParser->GetObjectType(objnum); + const CPDF_Parser::ObjectType object_type = m_pParser->GetObjectType(objnum); if (m_pParser->IsVersionUpdated() || m_bSecurityChanged || bExistInMap || - (object_type == 2 && m_pEncryptDict)) { + (object_type == CPDF_Parser::ObjectType::kCompressed && m_pEncryptDict)) { CPDF_Object* pObj = m_pDocument->GetOrParseIndirectObject(objnum); if (!pObj) { m_ObjectOffsets.erase(objnum); @@ -341,7 +341,7 @@ bool CPDF_Creator::WriteOldIndirectObject(uint32_t objnum) { m_pParser->GetIndirectBinary(objnum, pBuffer, size); if (!pBuffer) return true; - if (object_type == 2) { + if (object_type == CPDF_Parser::ObjectType::kCompressed) { if (!m_Archive->WriteDWord(objnum) || !m_Archive->WriteString(" 0 obj ") || !m_Archive->WriteBlock(pBuffer, size) || @@ -412,7 +412,7 @@ void CPDF_Creator::InitNewObjNumOffsets() { continue; } if (m_pParser && m_pParser->IsValidObjectNumber(objnum) && - m_pParser->GetObjectType(objnum)) { + m_pParser->GetObjectType(objnum) != CPDF_Parser::ObjectType::kFree) { continue; } m_NewObjNumArray.insert(std::lower_bound(m_NewObjNumArray.begin(), -- cgit v1.2.3