summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.cpp18
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.h10
2 files changed, 12 insertions, 16 deletions
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index b539117bd3..5792a80d14 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -9,12 +9,7 @@
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
CPDF_StreamAcc::CPDF_StreamAcc(const CPDF_Stream* pStream)
- : m_pData(nullptr),
- m_dwSize(0),
- m_bNewBuf(false),
- m_pImageParam(nullptr),
- m_pStream(pStream),
- m_pSrcData(nullptr) {}
+ : m_pStream(pStream) {}
CPDF_StreamAcc::~CPDF_StreamAcc() {
if (m_bNewBuf)
@@ -28,7 +23,8 @@ void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
if (!m_pStream)
return;
- if (m_pStream->IsMemoryBased() && (!m_pStream->HasFilter() || bRawAccess)) {
+ bool bProcessRawData = bRawAccess || !m_pStream->HasFilter();
+ if (bProcessRawData && m_pStream->IsMemoryBased()) {
m_dwSize = m_pStream->GetRawSize();
m_pData = m_pStream->GetRawData();
return;
@@ -38,14 +34,14 @@ void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
return;
uint8_t* pSrcData;
- if (!m_pStream->IsMemoryBased()) {
+ if (m_pStream->IsMemoryBased()) {
+ pSrcData = m_pStream->GetRawData();
+ } else {
pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
if (!m_pStream->ReadRawData(0, pSrcData, dwSrcSize))
return;
- } else {
- pSrcData = m_pStream->GetRawData();
}
- if (!m_pStream->HasFilter() || bRawAccess) {
+ if (bProcessRawData) {
m_pData = pSrcData;
m_dwSize = dwSrcSize;
} else if (!PDF_DataDecode(pSrcData, dwSrcSize, m_pStream->GetDict(),
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index 6a18c43975..52ac7e2e05 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -44,13 +44,13 @@ class CPDF_StreamAcc : public Retainable {
private:
uint8_t* GetDataHelper() const;
- uint8_t* m_pData;
- uint32_t m_dwSize;
- bool m_bNewBuf;
+ uint8_t* m_pData = nullptr;
+ uint32_t m_dwSize = 0;
+ bool m_bNewBuf = false;
ByteString m_ImageDecoder;
- CPDF_Dictionary* m_pImageParam;
+ CPDF_Dictionary* m_pImageParam = nullptr;
UnownedPtr<const CPDF_Stream> const m_pStream;
- uint8_t* m_pSrcData;
+ uint8_t* m_pSrcData = nullptr;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_