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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp

Issue 1406943005: Clear decoders after the image decoder in the /Filter array (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: back to "<=" Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/include/fpdfapi/fpdf_parser.h" 7 #include "core/include/fpdfapi/fpdf_parser.h"
8 8
9 #include "core/include/fxcrt/fx_string.h" 9 #include "core/include/fxcrt/fx_string.h"
10 10
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 if (CPDF_Stream* pStream = p->AsStream()) 489 if (CPDF_Stream* pStream = p->AsStream())
490 return pStream->GetDict(); 490 return pStream->GetDict();
491 return NULL; 491 return NULL;
492 } 492 }
493 CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const { 493 CPDF_Stream* CPDF_Array::GetStream(FX_DWORD i) const {
494 return ToStream(GetElementValue(i)); 494 return ToStream(GetElementValue(i));
495 } 495 }
496 CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const { 496 CPDF_Array* CPDF_Array::GetArray(FX_DWORD i) const {
497 return ToArray(GetElementValue(i)); 497 return ToArray(GetElementValue(i));
498 } 498 }
499 void CPDF_Array::RemoveAt(FX_DWORD i) { 499 void CPDF_Array::RemoveAt(FX_DWORD i, int nCount) {
500 ASSERT(IsArray());
501 if (i >= (FX_DWORD)m_Objects.GetSize()) 500 if (i >= (FX_DWORD)m_Objects.GetSize())
502 return; 501 return;
503 if (CPDF_Object* p = static_cast<CPDF_Object*>(m_Objects.GetAt(i))) 502
504 p->Release(); 503 if (nCount <= 0 || nCount > m_Objects.GetSize() - i)
505 m_Objects.RemoveAt(i); 504 return;
505
506 for (int j = 0; j < nCount; ++j) {
507 if (CPDF_Object* p = static_cast<CPDF_Object*>(m_Objects.GetAt(i + j)))
508 p->Release();
509 }
510 m_Objects.RemoveAt(i, nCount);
506 } 511 }
507 void CPDF_Array::SetAt(FX_DWORD i, 512 void CPDF_Array::SetAt(FX_DWORD i,
508 CPDF_Object* pObj, 513 CPDF_Object* pObj,
509 CPDF_IndirectObjects* pObjs) { 514 CPDF_IndirectObjects* pObjs) {
510 ASSERT(IsArray()); 515 ASSERT(IsArray());
511 ASSERT(i < (FX_DWORD)m_Objects.GetSize()); 516 ASSERT(i < (FX_DWORD)m_Objects.GetSize());
512 if (i >= (FX_DWORD)m_Objects.GetSize()) 517 if (i >= (FX_DWORD)m_Objects.GetSize())
513 return; 518 return;
514 if (CPDF_Object* pOld = static_cast<CPDF_Object*>(m_Objects.GetAt(i))) 519 if (CPDF_Object* pOld = static_cast<CPDF_Object*>(m_Objects.GetAt(i)))
515 pOld->Release(); 520 pOld->Release();
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 } 1174 }
1170 pObj->m_ObjNum = objnum; 1175 pObj->m_ObjNum = objnum;
1171 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); 1176 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj);
1172 if (m_LastObjNum < objnum) { 1177 if (m_LastObjNum < objnum) {
1173 m_LastObjNum = objnum; 1178 m_LastObjNum = objnum;
1174 } 1179 }
1175 } 1180 }
1176 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { 1181 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const {
1177 return m_LastObjNum; 1182 return m_LastObjNum;
1178 } 1183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698