Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Unified Diff: core/fpdfapi/parser/cpdf_syntax_parser.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_string.cpp ('k') | core/fpdfapi/parser/fpdf_parser_utility.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_syntax_parser.cpp
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 6a38ce8c45b5557fb1f3c8da20c8da9125ea62e5..4a0fd3a4088cb803978a13b97279b7aba8f44441 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;
}
« no previous file with comments | « core/fpdfapi/parser/cpdf_string.cpp ('k') | core/fpdfapi/parser/fpdf_parser_utility.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698