summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-12 20:59:25 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-12 20:59:25 +0000
commitc9f4f0dbcaaf9e86ef2b64c844b094bd2f6b1a92 (patch)
treec4090d428ea0b8ece5ab8eb163b6953e7d8869bc /core/fpdfapi
parent2772a2d944c8573aa187339b0b5ea059d1293c36 (diff)
downloadpdfium-c9f4f0dbcaaf9e86ef2b64c844b094bd2f6b1a92.tar.xz
Make some CPDF_StreamContentParser methods const.
Change-Id: Idd1d865741bb487647fa823846ea5751245ed86a Reviewed-on: https://pdfium-review.googlesource.com/30453 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.h8
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,