From 52008e9c520e8b1a7e2a9d76578ac2b27fe3e06a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 6 Nov 2017 15:21:30 +0000 Subject: Mark some CPDF_StreamContentParser members as const. Change-Id: I6c4ee5400307c8321f2558287f4d7571c373fcaa Reviewed-on: https://pdfium-review.googlesource.com/17795 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fpdfapi/page/cpdf_streamcontentparser.cpp | 13 ++++++------- core/fpdfapi/page/cpdf_streamcontentparser.h | 8 ++++---- 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()), - 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(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(value) + : *reinterpret_cast(&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 const m_pDocument; - UnownedPtr m_pPageResources; - UnownedPtr m_pParentResources; + UnownedPtr const m_pPageResources; + UnownedPtr const m_pParentResources; UnownedPtr m_pResources; - UnownedPtr m_pObjectHolder; - UnownedPtr> m_ParsedSet; + UnownedPtr const m_pObjectHolder; + UnownedPtr> const m_ParsedSet; CFX_Matrix m_mtContentToUser; const CFX_FloatRect m_BBox; ContentParam m_ParamBuf[kParamBufSize]; -- cgit v1.2.3