Rename CPDF_StreamContentParser::ContentParam::Type values to kFoo.
Bug: pdfium:547
Change-Id: Idde85cc007201b39beaf6eda3e46e392be1fe76d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81995
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 8100e71..99444e5 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -286,7 +286,7 @@
if (m_ParamStartPos == kParamBufSize) {
m_ParamStartPos = 0;
}
- if (m_ParamBuf[m_ParamStartPos].m_Type == ContentParam::OBJECT)
+ if (m_ParamBuf[m_ParamStartPos].m_Type == ContentParam::kObject)
m_ParamBuf[m_ParamStartPos].m_pObject.Reset();
return m_ParamStartPos;
@@ -301,26 +301,26 @@
void CPDF_StreamContentParser::AddNameParam(ByteStringView bsName) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
- param.m_Type = ContentParam::NAME;
+ param.m_Type = ContentParam::kName;
param.m_Name = PDF_NameDecode(bsName);
}
void CPDF_StreamContentParser::AddNumberParam(ByteStringView str) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
- param.m_Type = ContentParam::NUMBER;
+ param.m_Type = ContentParam::kNumber;
param.m_Number = FX_Number(str);
}
void CPDF_StreamContentParser::AddObjectParam(RetainPtr<CPDF_Object> pObj) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
- param.m_Type = ContentParam::OBJECT;
+ param.m_Type = ContentParam::kObject;
param.m_pObject = std::move(pObj);
}
void CPDF_StreamContentParser::ClearAllParams() {
uint32_t index = m_ParamStartPos;
for (uint32_t i = 0; i < m_ParamCount; i++) {
- if (m_ParamBuf[index].m_Type == ContentParam::OBJECT)
+ if (m_ParamBuf[index].m_Type == ContentParam::kObject)
m_ParamBuf[index].m_pObject.Reset();
index++;
if (index == kParamBufSize)
@@ -339,20 +339,20 @@
real_index -= kParamBufSize;
}
ContentParam& param = m_ParamBuf[real_index];
- if (param.m_Type == ContentParam::NUMBER) {
- param.m_Type = ContentParam::OBJECT;
+ if (param.m_Type == ContentParam::kNumber) {
+ param.m_Type = ContentParam::kObject;
param.m_pObject =
param.m_Number.IsInteger()
? pdfium::MakeRetain<CPDF_Number>(param.m_Number.GetSigned())
: pdfium::MakeRetain<CPDF_Number>(param.m_Number.GetFloat());
return param.m_pObject.Get();
}
- if (param.m_Type == ContentParam::NAME) {
- param.m_Type = ContentParam::OBJECT;
+ if (param.m_Type == ContentParam::kName) {
+ param.m_Type = ContentParam::kObject;
param.m_pObject = m_pDocument->New<CPDF_Name>(param.m_Name);
return param.m_pObject.Get();
}
- if (param.m_Type == ContentParam::OBJECT)
+ if (param.m_Type == ContentParam::kObject)
return param.m_pObject.Get();
NOTREACHED();
@@ -368,7 +368,7 @@
real_index -= kParamBufSize;
const ContentParam& param = m_ParamBuf[real_index];
- if (param.m_Type == ContentParam::NAME)
+ if (param.m_Type == ContentParam::kName)
return param.m_Name;
if (param.m_Type == 0 && param.m_pObject)
@@ -386,7 +386,7 @@
real_index -= kParamBufSize;
const ContentParam& param = m_ParamBuf[real_index];
- if (param.m_Type == ContentParam::NUMBER)
+ if (param.m_Type == ContentParam::kNumber)
return param.m_Number.GetFloat();
if (param.m_Type == 0 && param.m_pObject)
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h
index a23f6df..b179d3e 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -71,7 +71,7 @@
enum class RenderType : bool { kFill = false, kStroke = true };
struct ContentParam {
- enum Type { OBJECT = 0, NUMBER, NAME };
+ enum Type : uint8_t { kObject = 0, kNumber, kName };
ContentParam();
~ContentParam();