summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_syntax_parser.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-18 16:22:41 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-18 16:22:41 -0800
commit0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 (patch)
tree07c55fac710b191cf5d1d6595c63b90ca52e3cbb /core/fpdfapi/parser/cpdf_syntax_parser.cpp
parent430ab8363e77c48b2c2435af4d289f85e2be1b96 (diff)
downloadpdfium-0e606b5ecd6e45f74391f110cc1fe0cce0e80c64.tar.xz
Make CPDF_Dictionary use unique pointers.chromium/2926
Some changes were required to match underlying ctors as invoked by the templated methods. Many release() calls go away, a few WrapUniques() are introduced to avoid going deeper into other code. Review-Url: https://codereview.chromium.org/2510223002
Diffstat (limited to 'core/fpdfapi/parser/cpdf_syntax_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 6a38ce8c45..4a0fd3a408 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/parser/cpdf_syntax_parser.h"
+#include <algorithm>
+#include <utility>
#include <vector>
#include "core/fpdfapi/cpdf_modulemgr.h"
@@ -458,7 +460,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObject(
continue;
CFX_ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
- pDict->SetFor(keyNoSlash, pObj.release());
+ pDict->SetFor(keyNoSlash, std::move(pObj));
}
// Only when this is a signature dictionary and has contents, we reset the
@@ -466,8 +468,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObject(
if (pDict->IsSignatureDict() && dwSignValuePos) {
CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
m_Pos = dwSignValuePos;
- pDict->SetFor("Contents",
- GetObject(pObjList, objnum, gennum, false).release());
+ pDict->SetFor("Contents", GetObject(pObjList, objnum, gennum, false));
}
FX_FILESIZE SavedPos = m_Pos;
@@ -576,7 +577,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectForStrict(
if (key.GetLength() > 1) {
pDict->SetFor(CFX_ByteString(key.c_str() + 1, key.GetLength() - 1),
- obj.release());
+ std::move(obj));
}
}
@@ -722,7 +723,7 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
delete pDict;
return nullptr;
}
- pDict->SetIntegerFor("Length", len);
+ pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(len));
}
m_Pos = streamStartPos;
}