summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_dictionary.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-07-28 14:34:37 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-07-28 18:20:46 +0000
commit106eecd27f346a0bc7f11f29a058a8fd16a77682 (patch)
treec93ae48b75bbba90ca404d3c40a1e08ecba59ac2 /core/fpdfapi/parser/cpdf_dictionary.cpp
parent834ebece214f06c6e9fda803ab321e8453b3a54b (diff)
downloadpdfium-106eecd27f346a0bc7f11f29a058a8fd16a77682.tar.xz
Return removed value from dictionary.
Change-Id: I218179565cd991b71fd9c909b94f967bbf80c74d Reviewed-on: https://pdfium-review.googlesource.com/8912 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_dictionary.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index cbefb5d56d..a339a8becd 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -197,8 +197,15 @@ void CPDF_Dictionary::ConvertToIndirectObjectFor(
it->second = pdfium::MakeUnique<CPDF_Reference>(pHolder, pObj->GetObjNum());
}
-void CPDF_Dictionary::RemoveFor(const CFX_ByteString& key) {
- m_Map.erase(key);
+std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(
+ const CFX_ByteString& key) {
+ std::unique_ptr<CPDF_Object> result;
+ auto it = m_Map.find(key);
+ if (it != m_Map.end()) {
+ result = std::move(it->second);
+ m_Map.erase(it);
+ }
+ return result;
}
void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,