summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-17 18:56:38 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-17 18:56:38 +0000
commit231320c4acdcc2404e495ace6cb14f33f591b629 (patch)
tree2021c9da32e9d00269876925d249300ac11740d4 /core/fpdfapi
parent222db47cd745c223bbf52ac5770909c41dc660b8 (diff)
downloadpdfium-231320c4acdcc2404e495ace6cb14f33f591b629.tar.xz
Remove CPDF_StreamAcc::m_pSrcData.
It just ends up being a nullptr, so it is not useful. Change-Id: I52fcbb261c4bb0bc024e1856da95028431d577c1 Reviewed-on: https://pdfium-review.googlesource.com/42591 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.cpp12
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.h1
2 files changed, 5 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index 78bcb57e0b..4614dae710 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -14,7 +14,6 @@ CPDF_StreamAcc::CPDF_StreamAcc(const CPDF_Stream* pStream)
CPDF_StreamAcc::~CPDF_StreamAcc() {
if (m_bNewBuf)
FX_Free(m_pData);
- FX_Free(m_pSrcData);
}
void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
@@ -42,12 +41,12 @@ void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
if (m_pStream->IsMemoryBased()) {
pSrcData = m_pStream->GetInMemoryRawData();
} else {
- pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
- if (!m_pStream->ReadRawData(0, pSrcData, dwSrcSize)) {
- FX_Free(pSrcData);
- pSrcData = m_pSrcData = nullptr;
+ std::unique_ptr<uint8_t, FxFreeDeleter> pTempSrcData(
+ FX_Alloc(uint8_t, dwSrcSize));
+ if (!m_pStream->ReadRawData(0, pTempSrcData.get(), dwSrcSize))
return;
- }
+
+ pSrcData = pTempSrcData.release();
}
if (bProcessRawData) {
m_pData = pSrcData;
@@ -60,7 +59,6 @@ void CPDF_StreamAcc::LoadAllData(bool bRawAccess,
}
if (pSrcData != m_pStream->GetInMemoryRawData() && pSrcData != m_pData)
FX_Free(pSrcData);
- m_pSrcData = nullptr;
m_bNewBuf = m_pData != m_pStream->GetInMemoryRawData();
}
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index ddbdc6ae0f..6ecfece5ab 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -53,7 +53,6 @@ class CPDF_StreamAcc final : public Retainable {
ByteString m_ImageDecoder;
UnownedPtr<const CPDF_Dictionary> m_pImageParam;
UnownedPtr<const CPDF_Stream> const m_pStream;
- uint8_t* m_pSrcData = nullptr;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_STREAM_ACC_H_