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

Side by Side Diff: core/fpdfapi/parser/cpdf_stream.h

Issue 2584683002: Return unique_ptr from CFX_BinaryBuf::DetachBuffer() (Closed)
Patch Set: 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_object_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_stream.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 #ifndef CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
9 9
10 #include <memory> 10 #include <memory>
11 #include <set> 11 #include <set>
12 12
13 #include "core/fpdfapi/parser/cpdf_dictionary.h" 13 #include "core/fpdfapi/parser/cpdf_dictionary.h"
14 #include "core/fpdfapi/parser/cpdf_object.h" 14 #include "core/fpdfapi/parser/cpdf_object.h"
15 #include "core/fxcrt/fx_basic.h" 15 #include "core/fxcrt/fx_basic.h"
16 16
17 class CPDF_Stream : public CPDF_Object { 17 class CPDF_Stream : public CPDF_Object {
18 public: 18 public:
19 CPDF_Stream(); 19 CPDF_Stream();
20 20
21 // Takes ownership of |pData|. 21 // Takes ownership of |pData|.
22 CPDF_Stream(uint8_t* pData, 22 CPDF_Stream(std::unique_ptr<uint8_t, FxFreeDeleter> pData,
23 uint32_t size, 23 uint32_t size,
24 std::unique_ptr<CPDF_Dictionary> pDict); 24 std::unique_ptr<CPDF_Dictionary> pDict);
25 25
26 ~CPDF_Stream() override; 26 ~CPDF_Stream() override;
27 27
28 // CPDF_Object: 28 // CPDF_Object:
29 Type GetType() const override; 29 Type GetType() const override;
30 std::unique_ptr<CPDF_Object> Clone() const override; 30 std::unique_ptr<CPDF_Object> Clone() const override;
31 CPDF_Dictionary* GetDict() const override; 31 CPDF_Dictionary* GetDict() const override;
32 CFX_WideString GetUnicodeText() const override; 32 CFX_WideString GetUnicodeText() const override;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 inline std::unique_ptr<CPDF_Stream> ToStream(std::unique_ptr<CPDF_Object> obj) { 76 inline std::unique_ptr<CPDF_Stream> ToStream(std::unique_ptr<CPDF_Object> obj) {
77 CPDF_Stream* pStream = ToStream(obj.get()); 77 CPDF_Stream* pStream = ToStream(obj.get());
78 if (!pStream) 78 if (!pStream)
79 return nullptr; 79 return nullptr;
80 obj.release(); 80 obj.release();
81 return std::unique_ptr<CPDF_Stream>(pStream); 81 return std::unique_ptr<CPDF_Stream>(pStream);
82 } 82 }
83 83
84 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ 84 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_object_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_stream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698