diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-04-09 18:30:24 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-09 18:30:24 +0000 |
commit | 53894390dba2ec571bab75157ebe60d11171ed07 (patch) | |
tree | a2187a69fdc5167be060c621370a6c7c84ebf2e3 /core/fpdfapi/parser/cpdf_stream_acc.h | |
parent | d45f9980995af5c6e4c68e32df89d3cccb0231ef (diff) | |
download | pdfium-53894390dba2ec571bab75157ebe60d11171ed07.tar.xz |
Use pdfium::span<> in CFX_BitStream, CPDF_SimpleParser.
Get bounds checks in parsers automatically when using spans.
Change-Id: I71fbe7b838435d455376db2f89817d807a9cdcfd
Reviewed-on: https://pdfium-review.googlesource.com/29830
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_stream_acc.h')
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream_acc.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h index ac5253a68b..89a454a0f0 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.h +++ b/core/fpdfapi/parser/cpdf_stream_acc.h @@ -14,6 +14,7 @@ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" #include "core/fxcrt/retain_ptr.h" +#include "third_party/base/span.h" class CPDF_StreamAcc : public Retainable { public: @@ -30,11 +31,11 @@ class CPDF_StreamAcc : public Retainable { const CPDF_Stream* GetStream() const { return m_pStream.Get(); } CPDF_Dictionary* GetDict() const; - ByteStringView GetDataView() { return ByteStringView(GetData(), GetSize()); } - - const uint8_t* GetData() const; - uint8_t* GetData(); + uint8_t* GetData() const; uint32_t GetSize() const; + pdfium::span<uint8_t> GetSpan() const { + return pdfium::make_span(GetData(), GetSize()); + } const ByteString& GetImageDecoder() const { return m_ImageDecoder; } const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } std::unique_ptr<uint8_t, FxFreeDeleter> DetachData(); @@ -44,8 +45,6 @@ class CPDF_StreamAcc : public Retainable { ~CPDF_StreamAcc() override; private: - uint8_t* GetDataHelper() const; - uint8_t* m_pData = nullptr; uint32_t m_dwSize = 0; bool m_bNewBuf = false; |