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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_document.cpp

Issue 2005653002: Distinguish between user and owner passwords. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix bug Created 4 years, 7 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
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/fpdfapi/fpdf_parser/include/cpdf_document.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 return 0; 711 return 0;
712 712
713 if (!pPages->KeyExist("Kids")) 713 if (!pPages->KeyExist("Kids"))
714 return 1; 714 return 1;
715 715
716 std::set<CPDF_Dictionary*> visited_pages; 716 std::set<CPDF_Dictionary*> visited_pages;
717 visited_pages.insert(pPages); 717 visited_pages.insert(pPages);
718 return CountPages(pPages, &visited_pages); 718 return CountPages(pPages, &visited_pages);
719 } 719 }
720 720
721 uint32_t CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { 721 uint32_t CPDF_Document::GetUserPermissions() const {
722 return m_pParser ? m_pParser->GetPermissions(bCheckRevision) 722 if (!m_pParser) {
723 : static_cast<uint32_t>(-1); 723 #ifndef PDF_ENABLE_XFA
724 return 0;
725 #else // PDF_ENABLE_XFA
726 return 0xFFFFFFFF;
Tom Sepez 2016/05/23 16:30:26 This has always bothered me. I suspect the 0 is w
Lei Zhang 2016/05/23 18:41:24 This is carried over from FPDF_GetDocPermissions()
727 #endif
728 }
729 return m_pParser->GetPermissions();
724 } 730 }
725 731
726 FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const { 732 FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const {
727 auto it = m_IndirectObjs.find(objnum); 733 auto it = m_IndirectObjs.find(objnum);
728 if (it != m_IndirectObjs.end()) { 734 if (it != m_IndirectObjs.end()) {
729 CPDF_Stream* pStream = it->second->AsStream(); 735 CPDF_Stream* pStream = it->second->AsStream();
730 bForm = pStream && pStream->GetDict()->GetStringBy("Subtype") == "Form"; 736 bForm = pStream && pStream->GetDict()->GetStringBy("Subtype") == "Form";
731 return TRUE; 737 return TRUE;
732 } 738 }
733 if (!m_pParser) { 739 if (!m_pParser) {
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 } 1445 }
1440 } 1446 }
1441 pFontDesc->SetAtInteger("StemV", fStemV); 1447 pFontDesc->SetAtInteger("StemV", fStemV);
1442 AddIndirectObject(pFontDesc); 1448 AddIndirectObject(pFontDesc);
1443 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc); 1449 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc);
1444 CFRelease(traits); 1450 CFRelease(traits);
1445 CFRelease(languages); 1451 CFRelease(languages);
1446 return LoadFont(pBaseDict); 1452 return LoadFont(pBaseDict);
1447 } 1453 }
1448 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1454 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698