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

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

Issue 2520493002: Make CPDF_Stream() take unique_ptr's to its dictionary. (Closed)
Patch Set: rebase, lint, fix new test. Created 4 years 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_stream.cpp ('k') | core/fxge/dib/fx_dib_engine_unittest.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 // 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/parser/cpdf_syntax_parser.h" 7 #include "core/fpdfapi/parser/cpdf_syntax_parser.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 pCryptoHandler->DecryptStream(context, pData, len, dest_buf); 745 pCryptoHandler->DecryptStream(context, pData, len, dest_buf);
746 pCryptoHandler->DecryptFinish(context, dest_buf); 746 pCryptoHandler->DecryptFinish(context, dest_buf);
747 747
748 FX_Free(pData); 748 FX_Free(pData);
749 pData = dest_buf.GetBuffer(); 749 pData = dest_buf.GetBuffer();
750 len = dest_buf.GetSize(); 750 len = dest_buf.GetSize();
751 dest_buf.DetachBuffer(); 751 dest_buf.DetachBuffer();
752 } 752 }
753 } 753 }
754 754
755 auto pStream = pdfium::MakeUnique<CPDF_Stream>(pData, len, pDict); 755 auto pStream =
756 pdfium::MakeUnique<CPDF_Stream>(pData, len, pdfium::WrapUnique(pDict));
756 streamStartPos = m_Pos; 757 streamStartPos = m_Pos;
757 FXSYS_memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1); 758 FXSYS_memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1);
758 GetNextWordInternal(nullptr); 759 GetNextWordInternal(nullptr);
759 760
760 int numMarkers = ReadEOLMarkers(m_Pos); 761 int numMarkers = ReadEOLMarkers(m_Pos);
761 if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && 762 if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) &&
762 numMarkers != 0 && 763 numMarkers != 0 &&
763 FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), 764 FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(),
764 kEndObjStr.GetLength()) == 0) { 765 kEndObjStr.GetLength()) == 0) {
765 m_Pos = streamStartPos; 766 m_Pos = streamStartPos;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 if (limit && m_Pos == limit) 913 if (limit && m_Pos == limit)
913 return -1; 914 return -1;
914 } 915 }
915 return -1; 916 return -1;
916 } 917 }
917 918
918 void CPDF_SyntaxParser::SetEncrypt( 919 void CPDF_SyntaxParser::SetEncrypt(
919 std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) { 920 std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler) {
920 m_pCryptoHandler = std::move(pCryptoHandler); 921 m_pCryptoHandler = std::move(pCryptoHandler);
921 } 922 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream.cpp ('k') | core/fxge/dib/fx_dib_engine_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698