diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-23 23:52:53 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-23 23:52:53 +0000 |
commit | 367ed462b51799c008795b19e886ccbed221b9be (patch) | |
tree | 3c94f25900ec5617954dbfd3e615e6a4751ddfcd /core/fpdfapi/parser/cpdf_stream.h | |
parent | c1dde5d9b3da2af6e6f81df09ed41ab9c34bbde4 (diff) | |
download | pdfium-367ed462b51799c008795b19e886ccbed221b9be.tar.xz |
Use pdfium::span<> in CPDF_Stream::SetData().
Conversion to span makes this more elegant in a number of places,
owing to std::vector directly converting to span, and the bytestring's
ToRawSpan().
Disambiguate single-argument forms to allow passing {} as
an argument.
Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2
Reviewed-on: https://pdfium-review.googlesource.com/41272
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_stream.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h index 4a5ac61011..3deb9cddec 100644 --- a/core/fpdfapi/parser/cpdf_stream.h +++ b/core/fpdfapi/parser/cpdf_stream.h @@ -18,7 +18,6 @@ class CPDF_Stream : public CPDF_Object { public: CPDF_Stream(); - CPDF_Stream(std::unique_ptr<uint8_t, FxFreeDeleter> pData, uint32_t size, std::unique_ptr<CPDF_Dictionary> pDict); @@ -42,17 +41,16 @@ class CPDF_Stream : public CPDF_Object { // Use CPDF_StreamAcc to data access in all cases. uint8_t* GetInMemoryRawData() const { return m_pDataBuf.get(); } - // Does not takes ownership of |pData|, copies into internally-owned buffer. - void SetData(const uint8_t* pData, uint32_t size); + // Copies span into internally-owned buffer. + void SetData(pdfium::span<const uint8_t> pData); void SetData(std::unique_ptr<uint8_t, FxFreeDeleter> pData, uint32_t size); - void SetData(std::ostringstream* stream); + void SetDataFromStringstream(std::ostringstream* stream); // Set data and remove "Filter" and "DecodeParms" fields from stream // dictionary. - void SetDataAndRemoveFilter(const uint8_t* pData, uint32_t size); - void SetDataAndRemoveFilter(std::ostringstream* stream); + void SetDataAndRemoveFilter(pdfium::span<const uint8_t> pData); + void SetDataFromStringstreamAndRemoveFilter(std::ostringstream* stream); - void InitStream(const uint8_t* pData, - uint32_t size, + void InitStream(pdfium::span<const uint8_t> pData, std::unique_ptr<CPDF_Dictionary> pDict); void InitStreamFromFile(const RetainPtr<IFX_SeekableReadStream>& pFile, std::unique_ptr<CPDF_Dictionary> pDict); |