Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2097)

Unified Diff: core/fpdfapi/parser/cpdf_stream_acc.cpp

Issue 2517513003: Add unit test for CXFA_FileRead. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream.cpp ('k') | xfa/fxfa/app/xfa_ffapp_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_stream_acc.cpp
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp
index 81439bc6773832e97451fa839d64de450d30590e..01d8e148dff96bf2d7e09e47fb74a7e3ceb50d4e 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.cpp
+++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp
@@ -24,17 +24,16 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
return;
m_pStream = pStream;
- if (pStream->IsMemoryBased() &&
- (!pStream->GetDict()->KeyExist("Filter") || bRawAccess)) {
+ if (pStream->IsMemoryBased() && (!pStream->HasFilter() || bRawAccess)) {
m_dwSize = pStream->GetRawSize();
m_pData = pStream->GetRawData();
return;
}
- uint8_t* pSrcData;
uint32_t dwSrcSize = pStream->GetRawSize();
if (dwSrcSize == 0)
return;
+ uint8_t* pSrcData;
if (!pStream->IsMemoryBased()) {
pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
if (!pStream->ReadRawData(0, pSrcData, dwSrcSize))
@@ -42,17 +41,14 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
} else {
pSrcData = pStream->GetRawData();
}
- if (!pStream->GetDict()->KeyExist("Filter") || bRawAccess) {
+ if (!pStream->HasFilter() || bRawAccess) {
+ m_pData = pSrcData;
+ m_dwSize = dwSrcSize;
+ } else if (!PDF_DataDecode(pSrcData, dwSrcSize, m_pStream->GetDict(), m_pData,
+ m_dwSize, m_ImageDecoder, m_pImageParam,
+ estimated_size, bImageAcc)) {
m_pData = pSrcData;
m_dwSize = dwSrcSize;
- } else {
- bool bRet = PDF_DataDecode(pSrcData, dwSrcSize, m_pStream->GetDict(),
- m_pData, m_dwSize, m_ImageDecoder, m_pImageParam,
- estimated_size, bImageAcc);
- if (!bRet) {
- m_pData = pSrcData;
- m_dwSize = dwSrcSize;
- }
}
if (pSrcData != pStream->GetRawData() && pSrcData != m_pData)
FX_Free(pSrcData);
« no previous file with comments | « core/fpdfapi/parser/cpdf_stream.cpp ('k') | xfa/fxfa/app/xfa_ffapp_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698