diff options
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.h | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index c251c5ec66..9cd05cbb2d 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -383,7 +383,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) { return nullptr; } -ByteString CPDF_StreamContentParser::GetString(uint32_t index) { +ByteString CPDF_StreamContentParser::GetString(uint32_t index) const { if (index >= m_ParamCount) { return ByteString(); } @@ -391,7 +391,7 @@ ByteString CPDF_StreamContentParser::GetString(uint32_t index) { if (real_index >= kParamBufSize) { real_index -= kParamBufSize; } - ContentParam& param = m_ParamBuf[real_index]; + const ContentParam& param = m_ParamBuf[real_index]; if (param.m_Type == ContentParam::NAME) { return ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len); } @@ -401,7 +401,7 @@ ByteString CPDF_StreamContentParser::GetString(uint32_t index) { return ByteString(); } -float CPDF_StreamContentParser::GetNumber(uint32_t index) { +float CPDF_StreamContentParser::GetNumber(uint32_t index) const { if (index >= m_ParamCount) { return 0; } @@ -409,7 +409,7 @@ float CPDF_StreamContentParser::GetNumber(uint32_t index) { if (real_index >= kParamBufSize) { real_index -= kParamBufSize; } - ContentParam& param = m_ParamBuf[real_index]; + const ContentParam& param = m_ParamBuf[real_index]; if (param.m_Type == ContentParam::NUMBER) { return param.m_Number.m_bInteger ? static_cast<float>(param.m_Number.m_Integer) diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h index 5dcfbe5308..ff80ae9ef1 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.h +++ b/core/fpdfapi/page/cpdf_streamcontentparser.h @@ -90,9 +90,11 @@ class CPDF_StreamContentParser { int GetNextParamPos(); void ClearAllParams(); CPDF_Object* GetObject(uint32_t index); - ByteString GetString(uint32_t index); - float GetNumber(uint32_t index); - int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); } + ByteString GetString(uint32_t index) const; + float GetNumber(uint32_t index) const; + int GetInteger(uint32_t index) const { + return static_cast<int>(GetNumber(index)); + } void OnOperator(const ByteStringView& op); void AddTextObject(ByteString* pText, float fInitKerning, |