From deadbfb7874ee8627d3a27efcfb965233f0c5cd4 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 12 Apr 2017 14:27:01 -0400 Subject: Remove params from CFGAS_Stream This Cl removes members from CFGAS_Stream which just mirror values that are stored in the stream impl or values which aren't used. Change-Id: Ia2da5a645f4dd3399b3452fd56d833fed341390c Reviewed-on: https://pdfium-review.googlesource.com/4056 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fgas/crt/ifgas_stream.cpp | 57 +++++++++---------------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) (limited to 'xfa/fgas/crt') diff --git a/xfa/fgas/crt/ifgas_stream.cpp b/xfa/fgas/crt/ifgas_stream.cpp index 38c94973d7..fa9b8db02d 100644 --- a/xfa/fgas/crt/ifgas_stream.cpp +++ b/xfa/fgas/crt/ifgas_stream.cpp @@ -130,10 +130,6 @@ class CFGAS_Stream : public IFGAS_Stream { std::unique_ptr m_pStreamImp; uint32_t m_dwAccess; - int32_t m_iTotalSize; - int32_t m_iPosition; - int32_t m_iLength; - int32_t m_iRefCount; }; class CFGAS_TextStream : public IFGAS_Stream { @@ -511,12 +507,7 @@ int32_t CFGAS_TextStream::WriteString(const wchar_t* pStr, int32_t iLength) { CFGAS_Stream::CFGAS_Stream(std::unique_ptr imp, uint32_t dwAccess) - : m_pStreamImp(std::move(imp)), - m_dwAccess(dwAccess), - m_iTotalSize(0), - m_iPosition(0), - m_iLength(m_pStreamImp->GetLength()), - m_iRefCount(1) {} + : m_pStreamImp(std::move(imp)), m_dwAccess(dwAccess) {} CFGAS_Stream::~CFGAS_Stream() {} @@ -531,15 +522,13 @@ int32_t CFGAS_Stream::GetLength() const { int32_t CFGAS_Stream::Seek(FX_STREAMSEEK eSeek, int32_t iOffset) { if (!m_pStreamImp) return -1; - m_iPosition = m_pStreamImp->Seek(eSeek, iOffset); - return m_iPosition; + return m_pStreamImp->Seek(eSeek, iOffset); } int32_t CFGAS_Stream::GetPosition() { if (!m_pStreamImp) return -1; - m_iPosition = m_pStreamImp->GetPosition(); - return m_iPosition; + return m_pStreamImp->GetPosition(); } bool CFGAS_Stream::IsEOF() const { @@ -551,15 +540,12 @@ int32_t CFGAS_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { if (!m_pStreamImp) return -1; - int32_t iLen = std::min(m_iLength - m_iPosition, iBufferSize); + int32_t iLen = std::min( + m_pStreamImp->GetLength() - m_pStreamImp->GetPosition(), iBufferSize); if (iLen <= 0) return 0; - if (m_pStreamImp->GetPosition() != m_iPosition) - m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); - iLen = m_pStreamImp->ReadData(pBuffer, iLen); - m_iPosition = m_pStreamImp->GetPosition(); - return iLen; + return m_pStreamImp->ReadData(pBuffer, iLen); } int32_t CFGAS_Stream::ReadString(wchar_t* pStr, @@ -569,18 +555,12 @@ int32_t CFGAS_Stream::ReadString(wchar_t* pStr, if (!m_pStreamImp) return -1; - int32_t iLen = std::min((m_iLength - m_iPosition) / 2, iMaxLength); + int32_t iLen = + std::min((m_pStreamImp->GetLength() - m_pStreamImp->GetPosition()) / 2, + iMaxLength); if (iLen <= 0) return 0; - if (m_pStreamImp->GetPosition() != m_iPosition) - m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); - - iLen = m_pStreamImp->ReadString(pStr, iLen, bEOS); - m_iPosition = m_pStreamImp->GetPosition(); - if (iLen > 0 && m_iPosition >= m_iLength) - bEOS = true; - - return iLen; + return m_pStreamImp->ReadString(pStr, iLen, bEOS); } int32_t CFGAS_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { @@ -589,14 +569,7 @@ int32_t CFGAS_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { return -1; if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) return -1; - if (m_pStreamImp->GetPosition() != m_iPosition) - m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); - - int32_t iLen = m_pStreamImp->WriteData(pBuffer, iBufferSize); - m_iPosition = m_pStreamImp->GetPosition(); - m_iLength = std::max(m_iLength, m_iPosition); - - return iLen; + return m_pStreamImp->WriteData(pBuffer, iBufferSize); } int32_t CFGAS_Stream::WriteString(const wchar_t* pStr, int32_t iLength) { @@ -605,13 +578,7 @@ int32_t CFGAS_Stream::WriteString(const wchar_t* pStr, int32_t iLength) { return -1; if ((m_dwAccess & FX_STREAMACCESS_Write) == 0) return -1; - if (m_pStreamImp->GetPosition() != m_iPosition) - m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); - - int32_t iLen = m_pStreamImp->WriteString(pStr, iLength); - m_iPosition = m_pStreamImp->GetPosition(); - m_iLength = std::max(m_iLength, m_iPosition); - return iLen; + return m_pStreamImp->WriteString(pStr, iLength); } void CFGAS_Stream::Flush() { -- cgit v1.2.3