summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-11-06 15:21:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-06 15:21:30 +0000
commit52008e9c520e8b1a7e2a9d76578ac2b27fe3e06a (patch)
treef42e80e0a7aca57dc75cd9e6c0edccb6b9c0ca5e
parentb1a3044cdcd99ab4c88927e8b840c0c712ae54e3 (diff)
downloadpdfium-52008e9c520e8b1a7e2a9d76578ac2b27fe3e06a.tar.xz
Mark some CPDF_StreamContentParser members as const.
Change-Id: I6c4ee5400307c8321f2558287f4d7571c373fcaa Reviewed-on: https://pdfium-review.googlesource.com/17795 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp13
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.h8
2 files changed, 10 insertions, 11 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 9e9c450c7d..3bd40d5b7c 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -256,14 +256,12 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
m_ParamStartPos(0),
m_ParamCount(0),
m_pCurStates(pdfium::MakeUnique<CPDF_AllStates>()),
- m_pLastTextObject(nullptr),
m_DefFontSize(0),
m_PathStartX(0.0f),
m_PathStartY(0.0f),
m_PathCurrentX(0.0f),
m_PathCurrentY(0.0f),
m_PathClipType(0),
- m_pLastImage(nullptr),
m_bColored(false),
m_bResourceMissing(false) {
if (pmtContentToUser)
@@ -412,12 +410,12 @@ float CPDF_StreamContentParser::GetNumber(uint32_t index) {
}
ContentParam& param = m_ParamBuf[real_index];
if (param.m_Type == ContentParam::NUMBER) {
- return param.m_Number.m_bInteger ? (float)param.m_Number.m_Integer
- : param.m_Number.m_Float;
+ return param.m_Number.m_bInteger
+ ? static_cast<float>(param.m_Number.m_Integer)
+ : param.m_Number.m_Float;
}
- if (param.m_Type == 0 && param.m_pObject) {
+ if (param.m_Type == 0 && param.m_pObject)
return param.m_pObject->GetNumber();
- }
return 0;
}
@@ -1619,7 +1617,8 @@ void CPDF_StreamContentParser::ParsePathObject() {
int value;
bool bInteger = FX_atonum(m_pSyntax->GetWord(), &value);
- params[nParams++] = bInteger ? (float)value : *(float*)&value;
+ params[nParams++] = bInteger ? static_cast<float>(value)
+ : *reinterpret_cast<float*>(&value);
break;
}
default:
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h
index e905c937b3..de4a92fc99 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -194,11 +194,11 @@ class CPDF_StreamContentParser {
void Handle_Invalid();
UnownedPtr<CPDF_Document> const m_pDocument;
- UnownedPtr<CPDF_Dictionary> m_pPageResources;
- UnownedPtr<CPDF_Dictionary> m_pParentResources;
+ UnownedPtr<CPDF_Dictionary> const m_pPageResources;
+ UnownedPtr<CPDF_Dictionary> const m_pParentResources;
UnownedPtr<CPDF_Dictionary> m_pResources;
- UnownedPtr<CPDF_PageObjectHolder> m_pObjectHolder;
- UnownedPtr<std::set<const uint8_t*>> m_ParsedSet;
+ UnownedPtr<CPDF_PageObjectHolder> const m_pObjectHolder;
+ UnownedPtr<std::set<const uint8_t*>> const m_ParsedSet;
CFX_Matrix m_mtContentToUser;
const CFX_FloatRect m_BBox;
ContentParam m_ParamBuf[kParamBufSize];