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

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

Issue 1540693002: Get rid of a few CPDF_Object Create() methods and just use new instead. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 5 years 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 pObj = new CPDF_Reference(pObjs, pObj->GetObjNum()); 537 pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
538 } 538 }
539 m_Objects.Add(pObj); 539 m_Objects.Add(pObj);
540 } 540 }
541 void CPDF_Array::AddName(const CFX_ByteString& str) { 541 void CPDF_Array::AddName(const CFX_ByteString& str) {
542 ASSERT(IsArray()); 542 ASSERT(IsArray());
543 Add(new CPDF_Name(str)); 543 Add(new CPDF_Name(str));
544 } 544 }
545 void CPDF_Array::AddString(const CFX_ByteString& str) { 545 void CPDF_Array::AddString(const CFX_ByteString& str) {
546 ASSERT(IsArray()); 546 ASSERT(IsArray());
547 Add(new CPDF_String(str)); 547 Add(new CPDF_String(str, FALSE));
548 } 548 }
549 void CPDF_Array::AddInteger(int i) { 549 void CPDF_Array::AddInteger(int i) {
550 ASSERT(IsArray()); 550 ASSERT(IsArray());
551 Add(new CPDF_Number(i)); 551 Add(new CPDF_Number(i));
552 } 552 }
553 void CPDF_Array::AddNumber(FX_FLOAT f) { 553 void CPDF_Array::AddNumber(FX_FLOAT f) {
554 ASSERT(IsArray()); 554 ASSERT(IsArray());
555 CPDF_Number* pNumber = new CPDF_Number; 555 CPDF_Number* pNumber = new CPDF_Number;
556 pNumber->SetNumber(f); 556 pNumber->SetNumber(f);
557 Add(pNumber); 557 Add(pNumber);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 774 }
775 void CPDF_Dictionary::SetAtInteger(const CFX_ByteStringC& key, int i) { 775 void CPDF_Dictionary::SetAtInteger(const CFX_ByteStringC& key, int i) {
776 SetAt(key, new CPDF_Number(i)); 776 SetAt(key, new CPDF_Number(i));
777 } 777 }
778 void CPDF_Dictionary::SetAtName(const CFX_ByteStringC& key, 778 void CPDF_Dictionary::SetAtName(const CFX_ByteStringC& key,
779 const CFX_ByteString& name) { 779 const CFX_ByteString& name) {
780 SetAt(key, new CPDF_Name(name)); 780 SetAt(key, new CPDF_Name(name));
781 } 781 }
782 void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key, 782 void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key,
783 const CFX_ByteString& str) { 783 const CFX_ByteString& str) {
784 SetAt(key, new CPDF_String(str)); 784 SetAt(key, new CPDF_String(str, FALSE));
785 } 785 }
786 void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key, 786 void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key,
787 CPDF_IndirectObjects* pDoc, 787 CPDF_IndirectObjects* pDoc,
788 FX_DWORD objnum) { 788 FX_DWORD objnum) {
789 SetAt(key, new CPDF_Reference(pDoc, objnum)); 789 SetAt(key, new CPDF_Reference(pDoc, objnum));
790 } 790 }
791 void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key, 791 void CPDF_Dictionary::AddReference(const CFX_ByteStringC& key,
792 CPDF_IndirectObjects* pDoc, 792 CPDF_IndirectObjects* pDoc,
793 FX_DWORD objnum) { 793 FX_DWORD objnum) {
794 AddValue(key, new CPDF_Reference(pDoc, objnum)); 794 AddValue(key, new CPDF_Reference(pDoc, objnum));
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 } 1170 }
1171 pObj->m_ObjNum = objnum; 1171 pObj->m_ObjNum = objnum;
1172 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); 1172 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj);
1173 if (m_LastObjNum < objnum) 1173 if (m_LastObjNum < objnum)
1174 m_LastObjNum = objnum; 1174 m_LastObjNum = objnum;
1175 return TRUE; 1175 return TRUE;
1176 } 1176 }
1177 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { 1177 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const {
1178 return m_LastObjNum; 1178 return m_LastObjNum;
1179 } 1179 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698