diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-07-03 18:07:54 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-03 18:07:54 +0000 |
commit | 87a12747eafe83b88502b546ed3ef79d31d73241 (patch) | |
tree | 806ad13ec0ca96c86f86400e113f9ef851bdb5e3 /core | |
parent | 1018198e505070005451a35638b657b43d1cd430 (diff) | |
download | pdfium-87a12747eafe83b88502b546ed3ef79d31d73241.tar.xz |
Use unowned ptr in cpdf_stream_acc
Change-Id: Ide081e462c83a5a209a2e6462dd12b298993f36f
Reviewed-on: https://pdfium-review.googlesource.com/36850
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream_acc.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.h | 3 |
3 files changed, 9 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h index 00bd353fcb..5d18723df5 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.h +++ b/core/fpdfapi/parser/cpdf_stream_acc.h @@ -37,7 +37,7 @@ class CPDF_StreamAcc : public Retainable { return pdfium::make_span(GetData(), GetSize()); } ByteString GetImageDecoder() const { return m_ImageDecoder; } - const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } + const CPDF_Dictionary* GetImageParam() const { return m_pImageParam.Get(); } std::unique_ptr<uint8_t, FxFreeDeleter> DetachData(); protected: @@ -49,7 +49,7 @@ class CPDF_StreamAcc : public Retainable { uint32_t m_dwSize = 0; bool m_bNewBuf = false; ByteString m_ImageDecoder; - const CPDF_Dictionary* m_pImageParam = nullptr; + UnownedPtr<const CPDF_Dictionary> m_pImageParam; UnownedPtr<const CPDF_Stream> const m_pStream; uint8_t* m_pSrcData = nullptr; }; diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index 0ca9b4eab2..82d84ab705 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -339,7 +339,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, uint8_t** dest_buf, uint32_t* dest_size, ByteString* ImageEncoding, - const CPDF_Dictionary** pImageParms) { + UnownedPtr<const CPDF_Dictionary>* pImageParams) { const CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectFor("Filter") : nullptr; if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName())) @@ -377,7 +377,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, *ImageEncoding = "FlateDecode"; *dest_buf = last_buf; *dest_size = last_size; - *pImageParms = pParam; + *pImageParams = pParam; return true; } offset = FPDFAPI_FlateOrLZWDecode(false, last_buf, last_size, pParam, @@ -394,7 +394,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, *ImageEncoding = "RunLengthDecode"; *dest_buf = last_buf; *dest_size = last_size; - *pImageParms = pParam; + *pImageParams = pParam; return true; } offset = RunLengthDecode(last_buf, last_size, &new_buf, &new_size); @@ -405,7 +405,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, else if (decoder == "CCF") decoder = "CCITTFaxDecode"; *ImageEncoding = std::move(decoder); - *pImageParms = pParam; + *pImageParams = pParam; *dest_buf = last_buf; *dest_size = last_size; return true; @@ -420,7 +420,7 @@ bool PDF_DataDecode(const uint8_t* src_buf, last_size = new_size; } ImageEncoding->clear(); - *pImageParms = nullptr; + *pImageParams = nullptr; *dest_buf = last_buf; *dest_size = last_size; return true; diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h index c0f636a231..328fd474c6 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.h +++ b/core/fpdfapi/parser/fpdf_parser_decode.h @@ -10,6 +10,7 @@ #include <memory> #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/unowned_ptr.h" class CCodec_ScanlineDecoder; class CPDF_Dictionary; @@ -80,6 +81,6 @@ bool PDF_DataDecode(const uint8_t* src_buf, uint8_t** dest_buf, uint32_t* dest_size, ByteString* ImageEncoding, - const CPDF_Dictionary** pImageParms); + UnownedPtr<const CPDF_Dictionary>* pImageParms); #endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_ |