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

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

Issue 1672153002: Tidy fpdfsave.cpp (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 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/include/fpdfapi/fpdf_parser.h" 7 #include "core/include/fpdfapi/fpdf_parser.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 bool CanReadFromBitStream(const CFX_BitStream* hStream, 76 bool CanReadFromBitStream(const CFX_BitStream* hStream,
77 const FX_SAFE_DWORD& num_bits) { 77 const FX_SAFE_DWORD& num_bits) {
78 return (num_bits.IsValid() && 78 return (num_bits.IsValid() &&
79 hStream->BitsRemaining() >= num_bits.ValueOrDie()); 79 hStream->BitsRemaining() >= num_bits.ValueOrDie());
80 } 80 }
81 81
82 } // namespace 82 } // namespace
83 83
84 // TODO(thestig) Using unique_ptr with ReleaseDeleter is still not ideal.
85 // Come up or wait for something better.
86 using ScopedFileStream =
87 std::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>;
88
89 bool IsSignatureDict(const CPDF_Dictionary* pDict) { 84 bool IsSignatureDict(const CPDF_Dictionary* pDict) {
90 CPDF_Object* pType = pDict->GetElementValue("Type"); 85 CPDF_Object* pType = pDict->GetElementValue("Type");
91 if (!pType) 86 if (!pType)
92 pType = pDict->GetElementValue("FT"); 87 pType = pDict->GetElementValue("FT");
93 return pType && pType->GetString() == "Sig"; 88 return pType && pType->GetString() == "Sig";
94 } 89 }
95 90
96 CPDF_Parser::CPDF_Parser() 91 CPDF_Parser::CPDF_Parser()
97 : m_pDocument(nullptr), 92 : m_pDocument(nullptr),
98 m_bOwnFileRead(true), 93 m_bOwnFileRead(true),
(...skipping 4628 matching lines...) Expand 10 before | Expand all | Expand 10 after
4727 if (!m_pLinearizedDict) 4722 if (!m_pLinearizedDict)
4728 return -1; 4723 return -1;
4729 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H"); 4724 CPDF_Array* pRange = m_pLinearizedDict->GetArrayBy("H");
4730 if (!pRange) 4725 if (!pRange)
4731 return -1; 4726 return -1;
4732 CPDF_Object* pStreamLen = pRange->GetElementValue(1); 4727 CPDF_Object* pStreamLen = pRange->GetElementValue(1);
4733 if (!pStreamLen) 4728 if (!pStreamLen)
4734 return -1; 4729 return -1;
4735 return pStreamLen->GetInteger(); 4730 return pStreamLen->GetInteger();
4736 } 4731 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698