| OLD | NEW |
| 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> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 bool bDirect, | 51 bool bDirect, |
| 52 std::set<const CPDF_Object*>* pVisited) const override; | 52 std::set<const CPDF_Object*>* pVisited) const override; |
| 53 | 53 |
| 54 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> m_pDict; | 54 std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> m_pDict; |
| 55 bool m_bMemoryBased = true; | 55 bool m_bMemoryBased = true; |
| 56 uint32_t m_dwSize = 0; | 56 uint32_t m_dwSize = 0; |
| 57 std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf; | 57 std::unique_ptr<uint8_t, FxFreeDeleter> m_pDataBuf; |
| 58 IFX_FileRead* m_pFile = nullptr; | 58 IFX_FileRead* m_pFile = nullptr; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Stream>>; | 61 using UniqueStream = std::unique_ptr<CPDF_Stream, ReleaseDeleter<CPDF_Object>>; |
| 62 | 62 |
| 63 inline CPDF_Stream* ToStream(CPDF_Object* obj) { | 63 inline CPDF_Stream* ToStream(CPDF_Object* obj) { |
| 64 return obj ? obj->AsStream() : nullptr; | 64 return obj ? obj->AsStream() : nullptr; |
| 65 } | 65 } |
| 66 | 66 |
| 67 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { | 67 inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { |
| 68 return obj ? obj->AsStream() : nullptr; | 68 return obj ? obj->AsStream() : nullptr; |
| 69 } | 69 } |
| 70 | 70 |
| 71 inline UniqueStream ToStream(UniqueObject obj) { |
| 72 CPDF_Stream* pStream = ToStream(obj.get()); |
| 73 if (!pStream) |
| 74 return nullptr; |
| 75 obj.release(); |
| 76 return UniqueStream(pStream); |
| 77 } |
| 78 |
| 71 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ | 79 #endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_H_ |
| OLD | NEW |