diff options
author | Nicolas Pena <npm@chromium.org> | 2017-11-08 15:49:51 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-08 15:49:51 +0000 |
commit | c064d54cd169390039eedae422bbb132f771d20a (patch) | |
tree | a9f94cd071c0bf1f1e0015ae9f055047dedc6810 /core/fpdfapi/parser | |
parent | 58629a0e49e4ebfb0a0171a4203d2fab4af63165 (diff) | |
download | pdfium-c064d54cd169390039eedae422bbb132f771d20a.tar.xz |
Use MaybeOwned in CPDF_ContentParser
Change-Id: I7e5daeafd70ef29bcc9bdebbae004fa4b946b83d
Reviewed-on: https://pdfium-review.googlesource.com/18019
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream_acc.cpp | 14 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream_acc.h | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp index ccc3fdae53..91d458f9a7 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.cpp +++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp @@ -61,9 +61,11 @@ CPDF_StreamAcc::~CPDF_StreamAcc() { } const uint8_t* CPDF_StreamAcc::GetData() const { - if (m_bNewBuf) - return m_pData; - return m_pStream ? m_pStream->GetRawData() : nullptr; + return GetDataHelper(); +} + +uint8_t* CPDF_StreamAcc::GetData() { + return GetDataHelper(); } uint32_t CPDF_StreamAcc::GetSize() const { @@ -83,3 +85,9 @@ std::unique_ptr<uint8_t, FxFreeDeleter> CPDF_StreamAcc::DetachData() { memcpy(p.get(), m_pData, m_dwSize); return p; } + +uint8_t* CPDF_StreamAcc::GetDataHelper() const { + if (m_bNewBuf) + return m_pData; + return m_pStream ? m_pStream->GetRawData() : nullptr; +} diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h index a8a2540880..c270285345 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.h +++ b/core/fpdfapi/parser/cpdf_stream_acc.h @@ -33,6 +33,7 @@ class CPDF_StreamAcc : public Retainable { } const uint8_t* GetData() const; + uint8_t* GetData(); uint32_t GetSize() const; const ByteString& GetImageDecoder() const { return m_ImageDecoder; } const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } @@ -42,6 +43,9 @@ class CPDF_StreamAcc : public Retainable { explicit CPDF_StreamAcc(const CPDF_Stream* pStream); ~CPDF_StreamAcc() override; + private: + uint8_t* GetDataHelper() const; + uint8_t* m_pData; uint32_t m_dwSize; bool m_bNewBuf; |