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

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

Issue 2478253002: Revert of Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: 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.h ('k') | core/fpdfdoc/cpdf_annot.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 45d97be771f8c27d54f33088019268d1f93e4b1e..c1ab1cf7682b959b0ce729aae95c1d7da627347f 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -441,7 +441,8 @@
int32_t nKeys = 0;
FX_FILESIZE dwSignValuePos = 0;
- std::unique_ptr<CPDF_Dictionary> pDict(new CPDF_Dictionary(m_pPool));
+ std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict(
+ new CPDF_Dictionary(m_pPool));
while (1) {
CFX_ByteString key = GetNextWord(nullptr);
if (key.IsEmpty())
@@ -545,7 +546,8 @@
}
if (word == "[") {
- std::unique_ptr<CPDF_Array> pArray(new CPDF_Array);
+ std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray(
+ new CPDF_Array);
while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, true))
pArray->Add(pObj);
@@ -558,7 +560,8 @@
}
if (word == "<<") {
- std::unique_ptr<CPDF_Dictionary> pDict(new CPDF_Dictionary(m_pPool));
+ std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict(
+ new CPDF_Dictionary(m_pPool));
while (1) {
FX_FILESIZE SavedPos = m_Pos;
CFX_ByteString key = GetNextWord(nullptr);
@@ -577,7 +580,7 @@
continue;
key = PDF_NameDecode(key);
- std::unique_ptr<CPDF_Object> obj(
+ std::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj(
GetObject(pObjList, objnum, gennum, true));
if (!obj) {
uint8_t ch;
@@ -705,7 +708,7 @@
// Can't find "endstream" or "endobj".
if (endStreamOffset < 0 && endObjOffset < 0) {
- delete pDict;
+ pDict->Release();
return nullptr;
}
@@ -731,7 +734,7 @@
}
if (len < 0) {
- delete pDict;
+ pDict->Release();
return nullptr;
}
pDict->SetIntegerFor("Length", len);
@@ -740,7 +743,7 @@
}
if (len < 0) {
- delete pDict;
+ pDict->Release();
return nullptr;
}
« no previous file with comments | « core/fpdfapi/parser/cpdf_string.h ('k') | core/fpdfdoc/cpdf_annot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698