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

Side by Side Diff: fpdfsdk/fpdfppo.cpp

Issue 1846083002: Remove CFX_{Byte,Wide}String::Equal in favor of "==". (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. Created 4 years, 8 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 | « fpdfsdk/fpdfdoc.cpp ('k') | xfa/fwl/basewidget/fwl_comboboximp.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 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 "public/fpdf_ppo.h" 7 #include "public/fpdf_ppo.h"
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc, 48 FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
49 CPDF_Document* pSrcPDFDoc) { 49 CPDF_Document* pSrcPDFDoc) {
50 if (!pDestPDFDoc || !pSrcPDFDoc) 50 if (!pDestPDFDoc || !pSrcPDFDoc)
51 return FALSE; 51 return FALSE;
52 52
53 CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot(); 53 CPDF_Dictionary* pNewRoot = pDestPDFDoc->GetRoot();
54 if (!pNewRoot) 54 if (!pNewRoot)
55 return FALSE; 55 return FALSE;
56 56
57 // Set the document information
58 CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo(); 57 CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
59 if (!DInfoDict) 58 if (!DInfoDict)
60 return FALSE; 59 return FALSE;
61 60
62 CFX_ByteString producerstr; 61 CFX_ByteString producerstr;
63 producerstr.Format("PDFium"); 62 producerstr.Format("PDFium");
64 DInfoDict->SetAt("Producer", new CPDF_String(producerstr, FALSE)); 63 DInfoDict->SetAt("Producer", new CPDF_String(producerstr, FALSE));
65 64
66 // Set type
67 CFX_ByteString cbRootType = pNewRoot->GetStringBy("Type", ""); 65 CFX_ByteString cbRootType = pNewRoot->GetStringBy("Type", "");
68 if (cbRootType.Equal("")) { 66 if (cbRootType.IsEmpty())
69 pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); 67 pNewRoot->SetAt("Type", new CPDF_Name("Catalog"));
70 }
71 68
72 CPDF_Object* pElement = pNewRoot->GetObjectBy("Pages"); 69 CPDF_Object* pElement = pNewRoot->GetObjectBy("Pages");
73 CPDF_Dictionary* pNewPages = 70 CPDF_Dictionary* pNewPages =
74 pElement ? ToDictionary(pElement->GetDirect()) : nullptr; 71 pElement ? ToDictionary(pElement->GetDirect()) : nullptr;
75 if (!pNewPages) { 72 if (!pNewPages) {
76 pNewPages = new CPDF_Dictionary; 73 pNewPages = new CPDF_Dictionary;
77 uint32_t NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); 74 uint32_t NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages);
78 pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON)); 75 pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPagesON));
79 } 76 }
80 77
81 CFX_ByteString cbPageType = pNewPages->GetStringBy("Type", ""); 78 CFX_ByteString cbPageType = pNewPages->GetStringBy("Type", "");
82 if (cbPageType.Equal("")) { 79 if (cbPageType == "") {
83 pNewPages->SetAt("Type", new CPDF_Name("Pages")); 80 pNewPages->SetAt("Type", new CPDF_Name("Pages"));
84 } 81 }
85 82
86 CPDF_Array* pKeysArray = pNewPages->GetArrayBy("Kids"); 83 CPDF_Array* pKeysArray = pNewPages->GetArrayBy("Kids");
87 if (!pKeysArray) { 84 if (!pKeysArray) {
88 CPDF_Array* pNewKids = new CPDF_Array; 85 CPDF_Array* pNewKids = new CPDF_Array;
89 uint32_t Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids); 86 uint32_t Kidsobjnum = pDestPDFDoc->AddIndirectObject(pNewKids);
90 87
91 pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum)); 88 pNewPages->SetAt("Kids", new CPDF_Reference(pDestPDFDoc, Kidsobjnum));
92 pNewPages->SetAt("Count", new CPDF_Number(0)); 89 pNewPages->SetAt("Count", new CPDF_Number(0));
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (!pSrcDict) 403 if (!pSrcDict)
407 return FALSE; 404 return FALSE;
408 405
409 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); 406 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot();
410 if (!pDstDict) 407 if (!pDstDict)
411 return FALSE; 408 return FALSE;
412 409
413 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE)); 410 pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE));
414 return TRUE; 411 return TRUE;
415 } 412 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfdoc.cpp ('k') | xfa/fwl/basewidget/fwl_comboboximp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698