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

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

Issue 2384883003: Remove CPDF_Object::Release() in favor of direct delete (Closed)
Patch Set: nits Created 4 years, 2 months 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
Index: core/fpdfapi/parser/cpdf_array.cpp
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index 0d0c02f28dc4acf8ce4d4d1eaf34160ea3137655..06935b602e4349c2a5eadf823813e66e625acad9 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -24,7 +24,7 @@ CPDF_Array::~CPDF_Array() {
m_ObjNum = kInvalidObjNum;
for (auto& it : m_Objects) {
if (it && it->GetObjNum() != kInvalidObjNum)
- it->Release();
+ delete it;
}
}
@@ -139,10 +139,9 @@ void CPDF_Array::RemoveAt(size_t i, size_t nCount) {
if (nCount <= 0 || nCount > m_Objects.size() - i)
return;
- for (size_t j = 0; j < nCount; ++j) {
- if (CPDF_Object* p = m_Objects[i + j])
- p->Release();
- }
+ for (size_t j = 0; j < nCount; ++j)
+ delete m_Objects[i + j];
+
m_Objects.erase(m_Objects.begin() + i, m_Objects.begin() + i + nCount);
}
@@ -166,9 +165,7 @@ void CPDF_Array::SetAt(size_t i, CPDF_Object* pObj) {
ASSERT(false);
return;
}
- if (CPDF_Object* pOld = m_Objects[i])
- pOld->Release();
-
+ delete m_Objects[i];
m_Objects[i] = pObj;
}

Powered by Google App Engine
This is Rietveld 408576698