diff options
author | Lei Zhang <thestig@chromium.org> | 2015-11-10 10:23:29 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-11-10 10:23:29 -0800 |
commit | e6e16954f0cdc324849fca9da883be8f131b3834 (patch) | |
tree | c1f29469c1cb4ff3811f9d9f9845d2fc2d7a2702 /core/include | |
parent | b27902b8995bb3e003daed6b0811ed746763c68d (diff) | |
download | pdfium-e6e16954f0cdc324849fca9da883be8f131b3834.tar.xz |
Cleanup CPDF_Stream:
- Remove CPDF_Stream::Create() and checks that it might fail.
- Remove m_pCryptoHandler that's always a nullptr.
- Remove m_FileOffset that's always 0.
- Rename file version of InitStream() to InitStreamFromFile().
- Use IsMemoryBased() in more places.
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1415163009 .
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fpdfapi/fpdf_objects.h | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index d6050aec0b..11589e65a2 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -466,12 +466,6 @@ inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { class CPDF_Stream : public CPDF_Object { public: - static CPDF_Stream* Create(uint8_t* pData, - FX_DWORD size, - CPDF_Dictionary* pDict) { - return new CPDF_Stream(pData, size, pDict); - } - CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); CPDF_Dictionary* GetDict() const { return m_pDict; } @@ -483,7 +477,7 @@ class CPDF_Stream : public CPDF_Object { void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); - void InitStream(IFX_FileRead* pFile, CPDF_Dictionary* pDict); + void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict); FX_BOOL Identical(CPDF_Stream* pOther) const; @@ -493,11 +487,17 @@ class CPDF_Stream : public CPDF_Object { uint8_t* pBuf, FX_DWORD buf_size) const; - FX_BOOL IsMemoryBased() const { return m_GenNum == (FX_DWORD)-1; } + FX_BOOL IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; } protected: + friend class CPDF_Object; + friend class CPDF_StreamAcc; + + static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1; ~CPDF_Stream(); + void InitStreamInternal(CPDF_Dictionary* pDict); + CPDF_Dictionary* m_pDict; FX_DWORD m_dwSize; @@ -509,15 +509,6 @@ class CPDF_Stream : public CPDF_Object { IFX_FileRead* m_pFile; }; - - FX_FILESIZE m_FileOffset; - - CPDF_CryptoHandler* m_pCryptoHandler; - - void InitStream(CPDF_Dictionary* pDict); - friend class CPDF_Object; - friend class CPDF_StreamAcc; - friend class CPDF_AttachmentAcc; }; inline CPDF_Stream* ToStream(CPDF_Object* obj) { return obj ? obj->AsStream() : nullptr; @@ -540,7 +531,7 @@ class CPDF_StreamAcc { const CPDF_Stream* GetStream() const { return m_pStream; } CPDF_Dictionary* GetDict() const { - return m_pStream ? m_pStream->GetDict() : NULL; + return m_pStream ? m_pStream->GetDict() : nullptr; } const uint8_t* GetData() const; |