From 9c292fef316739f43730f11b9a2b6d3e4b725b54 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 21 Jun 2018 15:02:24 +0000 Subject: Avoid const-refs to implicitly constructed strings. Because the invisible temporary goes out of scope at the next semicolon. Also avoid returning const string references since the cost is low to properly keep the string alive. Change-Id: Id283e4fd99f79a02d79d739a533a4ce05e831e2a Reviewed-on: https://pdfium-review.googlesource.com/35710 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fpdfdoc/cpdf_filespec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/fpdfdoc/cpdf_filespec.cpp') diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp index 88abea30d5..95254b7bb8 100644 --- a/core/fpdfdoc/cpdf_filespec.cpp +++ b/core/fpdfdoc/cpdf_filespec.cpp @@ -138,7 +138,7 @@ const CPDF_Stream* CPDF_FileSpec::GetFileStream() const { size_t end = pDict->GetStringFor("FS") == "URL" ? 2 : FX_ArraySize(kKeys); for (size_t i = 0; i < end; ++i) { - const ByteString& key = kKeys[i]; + ByteString key = kKeys[i]; if (!pDict->GetUnicodeTextFor(key).IsEmpty()) { const CPDF_Stream* pStream = pFiles->GetStreamFor(key); if (pStream) @@ -160,7 +160,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() { size_t end = pDict->GetStringFor("FS") == "URL" ? 2 : FX_ArraySize(kKeys); for (size_t i = 0; i < end; ++i) { - const ByteString& key = kKeys[i]; + ByteString key = kKeys[i]; if (!pDict->GetUnicodeTextFor(key).IsEmpty()) { CPDF_Stream* pStream = pFiles->GetStreamFor(key); if (pStream) -- cgit v1.2.3