diff options
author | Lei Zhang <thestig@chromium.org> | 2015-11-10 10:28:56 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-11-10 10:28:56 -0800 |
commit | 61aad4fbb6fb1081a40b2e144106f57cf443846c (patch) | |
tree | b15ec4b3f7af763a7cf55d19a8b9a409afc6d479 /core/include | |
parent | 5044cab9c228ecd39e0ba07f0f5cced0a1cf6dd4 (diff) | |
download | pdfium-61aad4fbb6fb1081a40b2e144106f57cf443846c.tar.xz |
Merge to XFA: 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.
TBR=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1415163009 .
(cherry picked from commit e6e16954f0cdc324849fca9da883be8f131b3834)
Review URL: https://codereview.chromium.org/1418493006 .
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; |