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

Side by Side Diff: core/fpdfapi/parser/cpdf_object_unittest.cpp

Issue 2385293002: Make CPDF_Object containers hold objects via unique pointers (Closed)
Patch Set: Remove duplicated line 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 unified diff | Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_dictionary.cpp ('k') | core/fpdfapi/parser/cpdf_parser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 #include "core/fpdfapi/parser/cpdf_array.h" 5 #include "core/fpdfapi/parser/cpdf_array.h"
6 #include "core/fpdfapi/parser/cpdf_boolean.h" 6 #include "core/fpdfapi/parser/cpdf_boolean.h"
7 #include "core/fpdfapi/parser/cpdf_dictionary.h" 7 #include "core/fpdfapi/parser/cpdf_dictionary.h"
8 #include "core/fpdfapi/parser/cpdf_name.h" 8 #include "core/fpdfapi/parser/cpdf_name.h"
9 #include "core/fpdfapi/parser/cpdf_null.h" 9 #include "core/fpdfapi/parser/cpdf_null.h"
10 #include "core/fpdfapi/parser/cpdf_number.h" 10 #include "core/fpdfapi/parser/cpdf_number.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 return true; 133 return true;
134 } 134 }
135 case CPDF_Object::DICTIONARY: { 135 case CPDF_Object::DICTIONARY: {
136 const CPDF_Dictionary* dict1 = obj1->AsDictionary(); 136 const CPDF_Dictionary* dict1 = obj1->AsDictionary();
137 const CPDF_Dictionary* dict2 = obj2->AsDictionary(); 137 const CPDF_Dictionary* dict2 = obj2->AsDictionary();
138 if (dict1->GetCount() != dict2->GetCount()) 138 if (dict1->GetCount() != dict2->GetCount())
139 return false; 139 return false;
140 for (CPDF_Dictionary::const_iterator it = dict1->begin(); 140 for (CPDF_Dictionary::const_iterator it = dict1->begin();
141 it != dict1->end(); ++it) { 141 it != dict1->end(); ++it) {
142 if (!Equal(it->second, dict2->GetObjectFor(it->first))) 142 if (!Equal(it->second.get(), dict2->GetObjectFor(it->first)))
143 return false; 143 return false;
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 case CPDF_Object::NULLOBJ: 147 case CPDF_Object::NULLOBJ:
148 return true; 148 return true;
149 case CPDF_Object::STREAM: { 149 case CPDF_Object::STREAM: {
150 const CPDF_Stream* stream1 = obj1->AsStream(); 150 const CPDF_Stream* stream1 = obj1->AsStream();
151 const CPDF_Stream* stream2 = obj2->AsStream(); 151 const CPDF_Stream* stream2 = obj2->AsStream();
152 if (!stream1->GetDict() && !stream2->GetDict()) 152 if (!stream1->GetDict() && !stream2->GetDict())
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 dict->SetFor("clams", pObj); 874 dict->SetFor("clams", pObj);
875 dict->ConvertToIndirectObjectFor("clams", &objects_holder); 875 dict->ConvertToIndirectObjectFor("clams", &objects_holder);
876 CPDF_Object* pRef = dict->GetObjectFor("clams"); 876 CPDF_Object* pRef = dict->GetObjectFor("clams");
877 CPDF_Object* pNum = dict->GetDirectObjectFor("clams"); 877 CPDF_Object* pNum = dict->GetDirectObjectFor("clams");
878 EXPECT_TRUE(pRef->IsReference()); 878 EXPECT_TRUE(pRef->IsReference());
879 EXPECT_TRUE(pNum->IsNumber()); 879 EXPECT_TRUE(pNum->IsNumber());
880 EXPECT_NE(pObj, pRef); 880 EXPECT_NE(pObj, pRef);
881 EXPECT_EQ(pObj, pNum); 881 EXPECT_EQ(pObj, pNum);
882 EXPECT_EQ(42, dict->GetIntegerFor("clams")); 882 EXPECT_EQ(42, dict->GetIntegerFor("clams"));
883 } 883 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_dictionary.cpp ('k') | core/fpdfapi/parser/cpdf_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698