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/parser/cpdf_parser.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_parser.h') diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h index efe10555f7..3acdbbfa6f 100644 --- a/core/fpdfapi/parser/cpdf_parser.h +++ b/core/fpdfapi/parser/cpdf_parser.h @@ -38,6 +38,13 @@ class CPDF_Parser { HANDLER_ERROR }; + enum class ObjectType : uint8_t { + kFree = 0x00, + kNotCompressed = 0x01, + kCompressed = 0x02, + kNull = 0xFF, + }; + // A limit on the maximum object number in the xref table. Theoretical limits // are higher, but this may be large enough in practice. static const uint32_t kMaxObjectNumber = 1048576; @@ -74,7 +81,7 @@ class CPDF_Parser { uint32_t GetLastObjNum() const; bool IsValidObjectNumber(uint32_t objnum) const; FX_FILESIZE GetObjectPositionOrZero(uint32_t objnum) const; - uint8_t GetObjectType(uint32_t objnum) const; + ObjectType GetObjectType(uint32_t objnum) const; uint16_t GetObjectGenNum(uint32_t objnum) const; bool IsVersionUpdated() const { return m_bVersionUpdated; } bool IsObjectFreeOrNull(uint32_t objnum) const; @@ -103,10 +110,10 @@ class CPDF_Parser { protected: struct ObjectInfo { - ObjectInfo() : pos(0), type(0), gennum(0) {} + ObjectInfo() : pos(0), type(ObjectType::kFree), gennum(0) {} FX_FILESIZE pos; - uint8_t type; + ObjectType type; uint16_t gennum; }; -- cgit v1.2.3