summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-09-13 19:41:40 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-13 19:41:40 +0000
commita2fc263db880054e1c2bee37af3f8a189b9e1d2f (patch)
tree1746168127823c351a8f1d46394df634b27c1f43 /core
parent29e180342e18873babf1c74f7c5c056f90a191b0 (diff)
downloadpdfium-a2fc263db880054e1c2bee37af3f8a189b9e1d2f.tar.xz
Reland "Make things more const-y"chromium/3552
This reverts commit 5700d9e2eea5813861920995815ac092fd7df973. Reason for revert: Harmless, I think. Original change's description: > Revert "Make things more const-y" > > This reverts commit 882ed81dec7afc5bc106f965af34f1e59407fd95. > > Reason for revert: Rule out that this be making embeddertest flakey. > Seems improbable, but maybe the const is allowing the compiler to use stale data in a non-logically const operation ??? > > Original change's description: > > Make things more const-y > > > > Follow up to https://pdfium-review.googlesource.com/c/pdfium/+/42350 > > to use const more in the changed code. > > > > BUG=chromium:881678 > > > > Change-Id: I7a88862952c9ba25ffa89c2827e1de322f3b5c33 > > Reviewed-on: https://pdfium-review.googlesource.com/42370 > > Commit-Queue: Ryan Harrison <rharrison@chromium.org> > > Reviewed-by: Lei Zhang <thestig@chromium.org> > > Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> > > TBR=thestig@chromium.org,hnakashima@chromium.org,rharrison@chromium.org > > Change-Id: Ifee656f151d3e6dab6de33c3b96b37b9809004c4 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: chromium:881678 > Reviewed-on: https://pdfium-review.googlesource.com/42372 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org Change-Id: I24de62969b039288596aa4d0b268ad49728e4891 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: chromium:881678 Reviewed-on: https://pdfium-review.googlesource.com/42393 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/font/cpdf_cmap.h2
-rw-r--r--core/fpdfapi/font/cpdf_cmapparser.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index 68ad26cfa3..5526293685 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -66,7 +66,7 @@ class CPDF_CMap final : public Retainable {
void SetVertical(bool vert) { m_bVertical = vert; }
void SetCodingScheme(CodingScheme scheme) { m_CodingScheme = scheme; }
- const std::vector<CodeRange>& GetMixedFourByteLeadingRanges() {
+ const std::vector<CodeRange>& GetMixedFourByteLeadingRanges() const {
return m_MixedFourByteLeadingRanges;
}
void AppendMixedFourByteLeadingRanges(const CodeRange& range) {
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 5bfe17b34f..fca1c92af9 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -109,7 +109,7 @@ void CPDF_CMapParser::ParseWord(const ByteStringView& word) {
m_Status = 0;
} else if (m_Status == 7) {
if (word == "endcodespacerange") {
- auto code_ranges = m_pCMap->GetMixedFourByteLeadingRanges();
+ const auto& code_ranges = m_pCMap->GetMixedFourByteLeadingRanges();
size_t nSegs = code_ranges.size();
if (nSegs == 1) {
m_pCMap->SetCodingScheme((code_ranges[0].m_CharSize == 2)
@@ -117,7 +117,7 @@ void CPDF_CMapParser::ParseWord(const ByteStringView& word) {
: CPDF_CMap::OneByte);
} else if (nSegs > 1) {
m_pCMap->SetCodingScheme(CPDF_CMap::MixedFourBytes);
- for (auto range : m_PendingRanges)
+ for (const auto& range : m_PendingRanges)
m_pCMap->AppendMixedFourByteLeadingRanges(range);
m_PendingRanges.clear();
}