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

Side by Side Diff: fpdfsdk/fsdk_baseannot.cpp

Issue 1853233002: Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix CPDF_Name::GetConstString() 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/fpdfppo.cpp ('k') | fpdfsdk/fsdk_baseform.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 <algorithm> 7 #include <algorithm>
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 if (!pAPDict) { 824 if (!pAPDict) {
825 pAPDict = new CPDF_Dictionary; 825 pAPDict = new CPDF_Dictionary;
826 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); 826 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict);
827 } 827 }
828 828
829 CPDF_Stream* pStream = nullptr; 829 CPDF_Stream* pStream = nullptr;
830 CPDF_Dictionary* pParentDict = nullptr; 830 CPDF_Dictionary* pParentDict = nullptr;
831 831
832 if (sAPState.IsEmpty()) { 832 if (sAPState.IsEmpty()) {
833 pParentDict = pAPDict; 833 pParentDict = pAPDict;
834 pStream = pAPDict->GetStreamBy(sAPType); 834 pStream = pAPDict->GetStreamBy(sAPType.AsByteStringC());
835 } else { 835 } else {
836 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType); 836 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType.AsByteStringC());
837 if (!pAPTypeDict) { 837 if (!pAPTypeDict) {
838 pAPTypeDict = new CPDF_Dictionary; 838 pAPTypeDict = new CPDF_Dictionary;
839 pAPDict->SetAt(sAPType, pAPTypeDict); 839 pAPDict->SetAt(sAPType.AsByteStringC(), pAPTypeDict);
840 } 840 }
841
842 pParentDict = pAPTypeDict; 841 pParentDict = pAPTypeDict;
843 pStream = pAPTypeDict->GetStreamBy(sAPState); 842 pStream = pAPTypeDict->GetStreamBy(sAPState.AsByteStringC());
844 } 843 }
845 844
846 if (!pStream) { 845 if (!pStream) {
847 pStream = new CPDF_Stream(nullptr, 0, nullptr); 846 pStream = new CPDF_Stream(nullptr, 0, nullptr);
848
849 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); 847 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
850 int32_t objnum = pDoc->AddIndirectObject(pStream); 848 int32_t objnum = pDoc->AddIndirectObject(pStream);
851 pParentDict->SetAtReference(sAPType, pDoc, objnum); 849 pParentDict->SetAtReference(sAPType.AsByteStringC(), pDoc, objnum);
852 } 850 }
853 851
854 CPDF_Dictionary* pStreamDict = pStream->GetDict(); 852 CPDF_Dictionary* pStreamDict = pStream->GetDict();
855 if (!pStreamDict) { 853 if (!pStreamDict) {
856 pStreamDict = new CPDF_Dictionary; 854 pStreamDict = new CPDF_Dictionary;
857 pStreamDict->SetAtName("Type", "XObject"); 855 pStreamDict->SetAtName("Type", "XObject");
858 pStreamDict->SetAtName("Subtype", "Form"); 856 pStreamDict->SetAtName("Subtype", "Form");
859 pStreamDict->SetAtInteger("FormType", 1); 857 pStreamDict->SetAtInteger("FormType", 1);
860 pStream->InitStream(nullptr, 0, pStreamDict); 858 pStream->InitStream(nullptr, 0, pStreamDict);
861 } 859 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 956
959 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { 957 CPDF_Page* CPDFSDK_Annot::GetPDFPage() {
960 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; 958 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr;
961 } 959 }
962 960
963 #ifdef PDF_ENABLE_XFA 961 #ifdef PDF_ENABLE_XFA
964 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { 962 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() {
965 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; 963 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr;
966 } 964 }
967 #endif // PDF_ENABLE_XFA 965 #endif // PDF_ENABLE_XFA
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfppo.cpp ('k') | fpdfsdk/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698